Crystal Reports is working fine locally, but when it is installed on the client's PC it shows a failed to open connection
error.
It's a Windows application in ASP.NET C# and I want it installed on Windows 10.
private void getinvoice_Click(object sender, EventArgs e)
{
string connStr = ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
con.Open();
SalesReportview f2 = new SalesReportview();
demo r1 = new demo();
string s = "select T1.prodnm, T1.mrp, T1.prodquntity, T1.amount, T1.tax, T1.Tax_rt, T2.tottaxamt, T2.SI_Date from GST_SalesInvoice T1 inner join GST_SalesInvoice_Head T2 on T1.invoice_no = T2.Invoice_No where T1.invoice_no = '" + ino.Text + "'";
SqlCommand cmd = new SqlCommand(s, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
r1.Load(Application.StartupPath + "~\\demo.rpt");
r1.SetDatabaseLogon("sa", "sa", "DESKTOP-PPIVSIR", "GSTApplication");
r1.SetDataSource(ds);
r1.SetParameterValue("Invnum", ino.Text);
f2.salescryrep.Refresh();
f2.salescryrep.ReportSource = r1;
f2.Show();
con.Close();
}
Make sure the data source (eg ODBC DSN) is set up correctly and matches the "bitness" (x86 or x64) of the Crystal runtime used by the app. For example, a 32-bit DSN can't be used for a 64-bit app.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.