Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I'm using CrystalReport in my web application. I'm using VS2013. my problem is after adding CrystalReportViewer and CrystalReportSource from tool box and wrote following code in button_click event
C#
protected void btn1_Click(object sender, EventArgs e)
            {
                ReportDocument rptDoc = new ReportDocument();
                rptDoc.Load(Server.MapPath("~/test_upload/CrystalReport1.rpt"));
                CrystalReportViewer1.ReportSource = rptDoc;
                CrystalReportViewer1.DataBind();
            }

it is not showing crystalreport or any data in browser. and not showing any error. How do I solve this?

What I have tried:

Changing the code
C#
protected void btn1_Click(object sender, EventArgs e)
            {
string constring = "Data Source=as400_2;User Id=FADLI;Authentication=Server;Initial Catalog=S065FD45;Network Transport Library=TCPIP;Host CCSID=37;PC Code Page=1252;Network Address=as400.asei.co.id;Network Port=446;Package Collection=FADLI;Default Schema=FADLI;Units of Work=RUW;Default Qualifier=FADLI;DBMS Platform=DB2MVS;Use Early Metadata=False;Defer Prepare=False;Persist Security Info=True;Derive Parameters=True;Pooling=False;Rowset Cache Size=0;DateTime as Char=False;Decimal As Numeric=False;BinaryCodePage=0;Datetime As Date=False;AutoCommit=True;LoadBalancing=False";

SqlConnection con = new SqlConnection(constring);
SqlCommand cmd = new SqlCommand("SELECT COBKD, COBDESC FROM ASEINDTA.MSTCOB", con);

DataTable dt = new DataTable();
SqlDataAdapter adp = new SqlDataAdapter();
adp.SelectCommand = cmd;
adp.Fill(dt);
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Server.MapPath("~/test_upload/CrystalReport1.rpt"));
rptDoc.SetDataSource(dt);
CrystalReportViewer1.ReportSource = rptDoc;
CrystalReportViewer1.DataBind();
}
Posted
Updated 12-Jun-19 21:39pm
Comments
[no name] 11-Jun-19 3:15am    
Maybe the table is empty.
Syafiqur Rahman 11-Jun-19 4:30am    
no. It's not. I've tried with queryBuilder, and showed the data.

use the developer console in your browser, and look at the network tab to make sure it is finding the file.
 
Share this answer
 
Comments
Syafiqur Rahman 11-Jun-19 23:32pm    
Can you tell me how do I do that?
The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.
 
Share this answer
 

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