Search code examples
asp.netsql-serverstimulsoft

A network-related or instance-specific error occurred while establishing a connection to sql server error 26 on stimulsoft Report


I use this connection string in my asp.net

<add name="DB_PersonnelEntities" 
     connectionString="metadata=res://*/Models.Model.csdl|res://*/Models.Model.ssdl|res://*/Models.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=REGAPP\SQL2014;initial catalog=DB_Personnel;user id=personnel;password=qwe123!;MultipleActiveResultSets=True;App=EntityFramework&quot;" 
     providerName="System.Data.EntityClient" />

and this code for StimulSoft

string connectionstring = ConfigurationManager.ConnectionStrings["DB_PersonnelEntities"].ConnectionString;
string serverlocation = HttpContext.Current.Server.MapPath(string.Empty);

StiReport mystireport = new StiReport();
mystireport.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("DB_PersonnelEntities", connectionstring));
mystireport.Load(serverlocation + "\\Report\\RptPersonnel.mrt");
mystireport.Dictionary.Variables["pid"].Value = id.ToString();
StiWebViewer1.Report = mystireport;
mvList.SetActiveView(vwReport);

The connection string works properly in all SQL connections of the program, except for Stimulsoft Report with the code shown above.

Note: this code and connection work properly for StimulSoft SQL connection and other sql connections on my PC and run from Visual Studio, but when the program is published on the server, the StimulSoft SQL connection shows an error 26.

I changed the connection string like this

<add name="Conn" 
     connectionString="Data Source=REGAPP\SQL2014;Initial Catalog=DB_Personnel;User Id=personnel;Password=qwe123!"   
     providerName="System.Data.SqlClient" />

and changed instance name / disabled firewall / checked user permission for procedure.

THANKS FOR HELP


Solution

  • The StimulSoft Save connection string (in Report.mrt file) That created on my PC. When I Publish My Program, The StimulSoft report Use the connection string embedded in Report.mrt file NOT the web.config.