Skip to Content
avatar image
Former Member

Error on crystal report only after publishing the application


this is my code in C# for printing a Crystal Report.

protected void Print(object sender, EventArgs e)    
           ImageButton lnkRowSelection = (ImageButton)sender;    
           ReportDocument cryRpt = new ReportDocument();    
           string[] commandArgs = lnkRowSelection.CommandArgument.ToString().Split(new char[] { ',' });    
           string idno = commandArgs[0];    
           string company = commandArgs[1];    
               if (lnkRowSelection.CommandArgument.ToString() == null)    
                   if (company == "True")    
                   if (lnkRowSelection.CommandArgument.ToString() != null)    
                       cryRpt.SetParameterValue("@idno", idno);    
                       cryRpt.SetParameterValue("Office", agr.getOffice());    
                       cryRpt.PrintToPrinter(2, true, 1, 2);     

Rep1 and Rep2 were created using Report Wizard and are binded to a sproc. Idno is a parameter for the sproc and office is a second parameter i added to the report.
I use integrated connection (even though I tried SQL authentication and I still get the same errors)

The problem is that I get the error "The types of the parameter field and parameter field current values are not compatible" but only when I use the published version. If I run the application through Visual Studio the report is printing just fine.

I'm using Windows Server 2012 R2, IIS 8.5 , Crystal Reports 13, .NET Framework 4.5.2

So far I've tried the following:

Checked that both parameters are data type String and getting string as input.
Checked that there are no null values as input.
Change .rpt properties to Content
Added asp_client to my application folder.
Tried printing a report without parameters, even though I don't get the error the report didn't print either.

Any ideas what might be wrong?

Thank you in advance.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 30, 2016 at 09:42 PM

    What CR for VS SP are you using?

    Use Fiddler to trace what and where it's failing.


    Add comment
    10|10000 characters needed characters exceeded