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

Stimulsoft Reports.NET discussion
Post Reply
Arjune
Posts: 20
Joined: Mon Jan 28, 2019 9:26 am

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

Post 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.
Max Shamanov
Posts: 768
Joined: Tue Sep 07, 2021 10:11 am

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

Post 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.
Arjune
Posts: 20
Joined: Mon Jan 28, 2019 9:26 am

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

Post 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?
Last edited by Arjune on Fri Mar 24, 2023 9:40 am, edited 1 time in total.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

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

Post by Lech Kulikowski »

Hello,

Yes, the SqlCommand should be set.

Thank you.
Post Reply