Crystal report: Unable to connect: incorrect log on parameters
This is the code of Crystal Report:
ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(Server.MapPath(ReportName + ".rpt"));
reportDocument.SetParameterValue("@userid", Convert.ToInt64(5));
reportDocument.SetParameterValue("@Reportname", ReportName);
reportDocument.SetParameterValue("@SessionId", Session.SessionID.ToString());
CrystalReportViewer1.ReportSource = reportDocument;
reportDocument.SetDatabaseLogon("sa", "Password1", "192.168.0.245", "databaseName", true);
It is saying "Unable to connect: incorrect log on parameters." although the login information is correct.
If I set the value to "reportDocument.SetDatabaseLogon("sa", "Password1", "192.168.0.240", "databaseName", true);" it is working fine wh开发者_开发百科ich is the login information was given during the designing the Crystal Report.
Can try this and see if it helps?
ConnectionInfo connectionInfo = new ConnectionInfo
{
UserID = user,
Password = pwd,
ServerName = server,
DatabaseName = db
};
TableLogOnInfo tableLogOnInfo = new TableLogOnInfo
{
ConnectionInfo = connectionInfo
};
foreach (Table table in reportDocument.Database.Tables)
{
table.ApplyLogOnInfo(tableLogOnInfo);
}
I have same problem but has solved.
The problem is in odbc connection. Just install SQL native client to add connection in odbc. Download link https://support.fotoware.com/hc/en-us/articles/208664385-Microsoft-SQL-Native-Client-fails-to-download-during-FotoWeb-setup
精彩评论