report.Render(false) ExecuteReader Error

Stimulsoft Reports.NET discussion
Post Reply
alharbi
Posts: 45
Joined: Wed Sep 05, 2007 1:56 pm
Location: KSA

report.Render(false) ExecuteReader Error

Post by alharbi »

hi,

I am having this error:
Message:ExecuteReader: CommandText property has not been initialized.
Type:System.InvalidOperationException

at this point:
report.Render(false)

sample code

DataTable dtTemp = new DataTable("lostpassword");
.
.
.
StiReport report = StiReport.GetReportFromAssembly("E:\\Projects\\HRS\\HRS\\lostpassword.dll");
report.RegData(dtTemp);
report.Render(false);

report.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, "E:\\Projects\\HRS\\HRS\\" + sUserID + ".pdf");

thank you .
alharbi
Posts: 45
Joined: Wed Sep 05, 2007 1:56 pm
Location: KSA

report.Render(false) ExecuteReader Error

Post by alharbi »

i am try to clear connection string but the problem still .


report.Dictionary.Databases.Clear();

report.Dictionary.Databases.Add(new StiSqlDatabase("HRS", strConString));
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

report.Render(false) ExecuteReader Error

Post by Jan »

Hello,

You are use Data from Sql database and from DataTable at same time?

Thank you.
alharbi
Posts: 45
Joined: Wed Sep 05, 2007 1:56 pm
Location: KSA

report.Render(false) ExecuteReader Error

Post by alharbi »


thank you ,

yes , but how i can useing Data from DataTable Only ?

In other words, how do I delete the link between the report file (during design) and the database?

I deleted The ConnectionString and SQL Stament Manual, but to no avail!

Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

report.Render(false) ExecuteReader Error

Post by Jan »

Hello,

You can use following code:

Code: Select all

report.Dictionary.Databases.Clear();
report.Dictionary.DataSources.Clear();
report.RegData(dataTable);
report.Dictionary.Synchronize();
If you need replace Sql Source by DataTable DataSource you need use same Name of Data Source.

Thank you.
Post Reply