Sql – Unable to connect: incorrect log on parameters Crystal report

crystal-reportssqlvisual studiovisual-studio-2008

I am using windows 7 ,SQL Server 2000 and VS 2008 / Crystal Report XI.

i am getting Below Error when click on GetReport Button.

Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Login failed for user 'sa'. SQL State: 42000 Native Error: Error in File C:\Users\bahadur\AppData\Local\Temp\Total_Sales_Comparision {C4649F80-D1F7-4AED-A4B1-0B8EF83996C6}.rpt: Unable to connect: incorrect log on parameters.
Blockquote

MY C# Code is below

ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "BRAVEALI-PC";
crConnectionInfo.DatabaseName = "SCM_TEST";
crConnectionInfo.UserID = "sa";
crConnectionInfo.Password = "myDB Password";

ReportDocument report = new ReportDocument();
report.Load(@"D:\Project's\SCM Reports\Total_Sales_Comparision.rpt");
report.SetParameterValue("@invcm_date_from", Convert.ToDateTime (TextBox4.Text));
report.SetParameterValue("@invcm_date_to", Convert .ToDateTime(TextBox5.Text));
CrystalReportViewer1.ReportSource = report;
//CrystalReportViewer1.RefreshReport();

Regards

Brave Ali

Best Answer

You never did anything with your crConnectionInfo object... you did not tie it back to you Report object.

It's giving you incorrect login info because you never set the login info.

Related Topic