on 04-01-2021 5:32 PM
Problem : Subreport object does not have commandText(SQLQuery) We are using CrystalReport .NetSdk v13, and ServicePack30 and used in 32bit application.
Initially this superb.rpt has multiple tables and we converted into single command based table in 2020CR designer and we are able to see the subreport data in design mode in CR Designer 2020.But when we integrate same rpt file in our 32bit application it is throwing 'System._ComObject' does not contain a definition for 'CommandText' for subreport object. Could you please help on this
Below is the code snippet:
ReportSQLQuery = string.Empty;
if (HasCommandObject())// To check whether it has command table
{
if (!ReportDocument.IsSubreport)// MainReport objectcommandText
{
CrystalDecisions.ReportAppServer.DataDefModel.CommandTable boCommandTable;
boCommandTable = (CrystalDecisions.ReportAppServer.DataDefModel.CommandTable)ReportDocument.ReportClientDocument.Database.Tables[0];
ReportSQLQuery = boCommandTable.CommandText;
}
else //SubReport Object commandText
{
PropertyInfo pi = ReportDocument.Database.Tables.GetType().GetProperty("RasTables", BindingFlags.NonPublic | BindingFlags.Instance);
ReportSQLQuery = ((dynamic)pi.GetValue(ReportDocument.Database.Tables, pi.GetIndexParameters()))[0].CommandText;
}
}
Hi Mahesh,
I fixed my Parameter test app that now gets subreport Command SQL.
Search for this KBA: 2281780 - How To: Parameters in Crystal Reports for Visual Studio .NET
And wiki here:
https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Where are you opening the subreport object to get it's Command?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
75 | |
10 | |
10 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.