Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am at the verge of hitting my head on a wall, i have been on this issue for days, i have googled and googled but to no avail. I design some crystal report using stored procedure, everything has been working fine on my development machine, even passing parameter to report from c# winform to setting the connection at runtime. Now it is time to deploy my app and install it on a client computer, this is where the problem began. first of all when i installed the app, the report refuse to open but my c# winform app is connecting to the database which is in the server very well. Then i was told to download and install some files(CRRuntime_32bit_13_0_12.msi and vcredist_x86) on client machine which i did. now the problem is that when i try to open my report, i get this very annoying message "Failed to open connection {Database vendor code 17} blah blah" i have tried updating datasource, verifying database and rebuilding app but no result.
Note:
1) Using vs2010
2) My connection type to crystal report is "OLEDB"
3) My database is sql server 2005 express edition
4) i dont know if this is neccessry but my development machine has a different servername and password, so when am deploying my app i always change the connection string in the app.config and in the report login prompt.
5) i used join and group by in my stored procedure.

Please any help will be verrrrrrrrryyyyyy and greatllllllllllly appreciated

here's my c# code for preventing prevent the loging form to show everytime report is loaded and a sample of one of my reports:

<pre lang="c#">
  private void LoadReports()
        {
public string BillNo = null, BillCategory = null, BillStatus = null;

ConnectionInfo CInfo = new ConnectionInfo();
            CInfo.ServerName = (@"DEKEYS-PC\PHILZ");
            CInfo.UserID = "sa";
            CInfo.Password = "password@1";
            CInfo.DatabaseName = "";


            TableLogOnInfo tableInfo = new TableLogOnInfo();
            tableInfo.ConnectionInfo = CInfo;

            TableLogOnInfos tablelog = new TableLogOnInfos();
            tablelog.Add(tableInfo);



                Reports.Bill_Wise_Summary history = new Reports.Bill_Wise_Summary();
                crystalReportViewer1.ReportSource = history;
                crystalReportViewer1.LogOnInfo = tablelog;

                paramField = new ParameterField();
                paramField.ParameterFieldName = "@BillNo";
                discreteVal = new ParameterDiscreteValue();
                discreteVal.Value = BillNo;
                paramField.CurrentValues.Add(discreteVal);
                paramFields.Add(paramField);

                paramField = new ParameterField();
                paramField.ParameterFieldName = "@BillCategory";
                discreteVal = new ParameterDiscreteValue();
                discreteVal.Value = BillCategory;
                paramField.CurrentValues.Add(discreteVal);
                paramFields.Add(paramField);

                paramField = new ParameterField();
                paramField.ParameterFieldName = "@BillStatus";
                discreteVal = new ParameterDiscreteValue();
                discreteVal.Value = BillStatus;
                paramField.CurrentValues.Add(discreteVal);
                paramFields.Add(paramField);
}



What I have tried:

private void LoadReports()
{
public string BillNo = null, BillCategory = null, BillStatus = null;

ConnectionInfo CInfo = new ConnectionInfo();
CInfo.ServerName = (@"DEKEYS-PC\PHILZ");
CInfo.UserID = "sa";
CInfo.Password = "password@1";
CInfo.DatabaseName = "";


TableLogOnInfo tableInfo = new TableLogOnInfo();
tableInfo.ConnectionInfo = CInfo;

TableLogOnInfos tablelog = new TableLogOnInfos();
tablelog.Add(tableInfo);



Reports.Bill_Wise_Summary history = new Reports.Bill_Wise_Summary();
crystalReportViewer1.ReportSource = history;
crystalReportViewer1.LogOnInfo = tablelog;

paramField = new ParameterField();
paramField.ParameterFieldName = "@BillNo";
discreteVal = new ParameterDiscreteValue();
discreteVal.Value = BillNo;
paramField.CurrentValues.Add(discreteVal);
paramFields.Add(paramField);

paramField = new ParameterField();
paramField.ParameterFieldName = "@BillCategory";
discreteVal = new ParameterDiscreteValue();
discreteVal.Value = BillCategory;
paramField.CurrentValues.Add(discreteVal);
paramFields.Add(paramField);

paramField = new ParameterField();
paramField.ParameterFieldName = "@BillStatus";
discreteVal = new ParameterDiscreteValue();
discreteVal.Value = BillStatus;
paramField.CurrentValues.Add(discreteVal);
paramFields.Add(paramField);
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900