Page 1 of 1

Error when trying to Render Report : CommandText property has not been initialized

Posted: Thu Mar 23, 2023 9:35 am
by Arjune
Dear support,

The used version of stimulsoft Reports.NET is 2023.1.6.

I currently have an issue using Reports.NET: when I try to render my report, I have the following error and I do not understand how to solve it :

Code: Select all

CommandText property has not been initialized
Here is the Stacktrace :

Code: Select all

 at Npgsql.NpgsqlCommand.ProcessRawQuery(Boolean standardConformingStrings, Boolean deriveParameters)
   at Npgsql.NpgsqlCommand.<ExecuteReader>d__105.MoveNext()
   at Npgsql.NpgsqlCommand.<ExecuteReader>d__105.MoveNext()
   at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at Stimulsoft.Report.Dictionary.StiDataAdapterHelper.Fill(StiDictionary dictionary, DbDataAdapter dataAdapter, DataTable dataTable, Boolean schemaOnly)
   at Stimulsoft.Report.Dictionary.StiSqlSource.RetrieveData(Boolean schemaOnly)
   at Stimulsoft.Report.Dictionary.StiSqlAdapterService.ConnectDataSourceToData(StiDictionary dictionary, StiDataSource dataSource, Boolean loadData)
   at Stimulsoft.Report.Dictionary.StiDataLeader.ConnectDataSourceToData(StiDataAdapterService adapter, StiDictionary dictionary, StiDataSource dataSource, Boolean loadData)
   at Stimulsoft.Report.Dictionary.StiDataSource.Connect(StiDataCollection datas, Boolean loadData, Boolean invokeEvents)
   at Stimulsoft.Report.Dictionary.StiDataSourcesCollection.Connect(StiDataCollection datas, Boolean loadData)
   at Stimulsoft.Report.Dictionary.StiDictionary.Connect(Boolean loadData, List`1 dataSources)
   at Stimulsoft.Report.Engine.StiRenderProviderV2.ConnectToData(StiReport report, Boolean isConnectToDataV2)
   at Stimulsoft.Report.Engine.StiRenderProviderV2.Render(StiReport report, StiRenderState state)
   at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState)
   at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
   at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
   at Stimulsoft.Report.StiReport.Render(StiRenderState renderState)
   at Stimulsoft.Report.StiReport.Render(Boolean showProgress, Int32 fromPage, Int32 toPage)
   at Stimulsoft.Report.StiReport.Render(Boolean showProgress)
   at Stimulsoft.Report.StiReport.Render()
   at TortillaApi.Business.Reports.Services.ReportGenerationService.ExportReport(StiReport stiReport, ExportType exportType, GenerateReportSettings generateReportSettings) in C:\wc\DataAvanGarde.StudioApi\TortillaApi.Business\Reports\Services\ReportGenerationService.cs:line 100
   at TortillaApi.Business.Workflows.Execution.Tasks.GenerateReportTask.<ExecuteImplementation>d__9.MoveNext() in C:\wc\DataAvanGarde.StudioApi\TortillaApi.Business.Workflows\Execution\Tasks\GenerateReportTask.cs:line 88

Could you please help me with this issue? Thank you.

Re: Error when trying to Render Report : CommandText property has not been initialized

Posted: Thu Mar 23, 2023 2:22 pm
by Max Shamanov
Hello,

It is difficult to say something without example.
Please send us a sample project that reproduces the issue for analysis.

Thank you.

Re: Error when trying to Render Report : CommandText property has not been initialized

Posted: Thu Mar 23, 2023 3:34 pm
by Arjune
Hello,
We managed to solve it on our side: the issue was that one of our datasources in the StiReport had an empty SqlCommand, which caused an issue when calling Render() on the StiReport object.
Apparently SqlCommand has to be filled for each datasources of the dictionary, is that correct?

Re: Error when trying to Render Report : CommandText property has not been initialized

Posted: Fri Mar 24, 2023 8:04 am
by Lech Kulikowski
Hello,

Yes, the SqlCommand should be set.

Thank you.