ASP.Net Stimulsoft Report Error: The ConnectionString property has not been initialized

Last Reply 3 months ago By dorsa

Posted 3 months ago

I have a Stimulsoft report. and now I want to use this report in asp.net.

when I call my report in the local mode it works truly in my system and didn't have any problem.

but when I publish my web form and change the connection string of my code to server address I faced to below error:

 

The ConnectionString property has not been initialized 

this is my code that calls my report:

LblCourseId.Text = Request.QueryString["CourseId"];
string ConnectionString = ConfigurationManager.ConnectionStrings["KDUIS-v1ConnectionString"].ConnectionString;
string ServerLocation = HttpContext.Current.Server.MapPath(string.Empty);
StiReport MyStiReport = new StiReport();
MyStiReport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", ConnectionString));
MyStiReport.Load(ServerLocation + "\\Report\\AttendanceList.mrt");
MyStiReport.Dictionary.Variables["CourseId"].Value = LblCourseId.Text;
StiWebViewer1.Report = MyStiReport;

and the current connection string that I used for the published site is:

<add name="KDUIS-v1ConnectionString" connectionString="Data Source=address of my site ;Initial Catalog= my db ;Persist Security Info=True;User ID=username ;Password= password " providerName="System.Data.SqlClient" />

I have searched through the Forum but couldn't find a way to do it. Many Thanks in advance.

Posted 3 months ago

Hi dorsa,

Please check the method StiSqlDatabase. What are the parameter required. You might passing wrong parameter.

Else check the below links.

https://stackoverflow.com/questions/38918921/how-can-i-set-connection-string-of-a-stimulsoft-report-at-run-time-on-web-servic

https://forum.stimulsoft.com/viewtopic.php?t=3628

 


Posted 3 months ago

my problem solved. instead  "Connection: I write the name of DB and after that my problem solved.