Click here to Skip to main content
15,847,902 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using Visual Studio 2008. When I run my project in client machine I'm getting this error, when try to print the report. This is working fine in my machine.
I have installed CR Runtime in client machine.
Crystal Report Windows Forms Viewer.

Error in File:C:\Users\Nuwan\AppData\Local\Temp\rptInvoice{C51266F3-E2EE-4A02-B5CF-12BCE727360C}.rpt: Unable to connect : incorrect logon parameters.


This is my code part.


    ReportDocument cryRpt = new ReportDocument();
    ParameterFieldDefinitions crParameterFieldDefinitions;
    ParameterFieldDefinition crParameterFieldDefinition;
    ParameterValues crParameterValues = new ParameterValues();
    ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

    crParameterDiscreteValue.Value = int.Parse(cmbInvoNo.Text);
    crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
    crParameterFieldDefinition = crParameterFieldDefinitions["InvoNo"];
    crParameterValues = crParameterFieldDefinition.CurrentValues;


    crystalReportViewer1.ReportSource = cryRpt;
catch (Exception ex)
Updated 13-Feb-12 3:08am

1 solution

Since the server is different from your development server and the client server. You should instruct you crystal report object to use different connection info. Try to use this code. I suggest to store credential on your app config. I hope this helps.

ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "YOUR SERVER NAME";
crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
crConnectionInfo.Password = "YOUR DATABASE PASSWORD";
CrTables = cryRpt.Database.Tables ;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
    crtableLogoninfo = CrTable.LogOnInfo;
    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
Share this answer
ldsroshan 13-Feb-12 19:10pm    
Please explain what are the data types of 'CrTables' and 'crtableLogoninfo'. Thanks.
ldsroshan 13-Feb-12 19:59pm    
I found it.
Thanks for the help.
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
Tables CrTables;
Michael dg 14-Feb-12 2:06am    
sorry i forgot to put the data types of those variables.
Member 10577976 26-Mar-14 6:02am    
It's not working..I am getting same error when Run the program

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