I work on crystal report Version 13 . I have main report have multi sub report my issue I get error after add second sub report
error in File temp_.rpt:\nUnable to connect: incorrect log on parameters.
this error happen after add second sub report and if I add any field on details section of second sub report error happened
if I leave details section empty of second sub report it working without any issue
I fill second sub report with
cr.Database.Tables["exchange_bulk_trans_settlements"].SetDataSource(exchange_bulk_trans_settlements)
full code csharp that fill report
public bool GetVendorsBulkTransactionsReport(string p_tenant_id, string p_permid, string p_userid, string p_language, string p_org_id, string p_from_date, string p_to_date, string p_vendor_id,string VendroName)
{
MyDatabase db = new MyDatabase();
ResponseStatus response = new ResponseStatus();
try
{
RptGetVendorsBulkTransactions cr = new RptGetVendorsBulkTransactions();
var ds = db.GetVendorsBulkTransactionsReport(p_tenant_id, p_permid, p_userid, p_language, p_org_id, p_from_date, p_to_date, p_vendor_id);
var exchange_bulk_trans_lines = ds.Tables["exchange_bulk_trans_lines"];
var exchange_bulk_trans_settlements = ds.Tables["exchange_bulk_trans_settlements"];
if (ds != null)
{
if (ds.Tables.Count > 0 && exchange_bulk_trans_lines.Rows.Count > 0 && exchange_bulk_trans_settlements.Rows.Count > 0)
{
cr.Database.Tables["exchange_bulk_trans_settlements"].SetDataSource(exchange_bulk_trans_settlements);
cr.Database.Tables["exchange_bulk_trans_lines"].SetDataSource(exchange_bulk_trans_lines);
CrystalReportViewer1.ReportSource = cr;
ExportFormatType formatType = ExportFormatType.PortableDocFormat;
cr.exortresponse(formatType, Response, false, string.Format("??? ?????? ?????"));
return true;
return true;
}
else
{
cr.Close();
cr.Dispose();
GC.Collect();
response = db.ErrorLog(MethodBase.GetCurrentMethod().Name, Common.GetStringWithoutQuate("No data available"), "Error while displaying the Vendor Bulk Transactions Report",
"app_sabayik.get_risk_eval_lookups", null,
null,
"req.P_PERM_ID = ", "P_COMPANY_NAME = ", "P_USER = ");
Response.Write("Unable to print the report at this time. Please try again later.");
return false;
}
}
else
{
cr.Close();
cr.Dispose();
GC.Collect();
response = db.ErrorLog(MethodBase.GetCurrentMethod().Name, Common.GetStringWithoutQuate("No data available"), "Error while displaying the Vendor Bulk Transactions Report",
"app_sabayik.get_risk_eval_lookups", null,
null,
"req.P_PERM_ID = ", "P_COMPANY_NAME = ", "P_USER = ");
Response.Write("Unable to print the report at this time. Please try again later.");
return false;
}
}
catch (Exception ex)
{
GC.Collect();
if (ex.Message != "Thread was being aborted.")
{
response = db.ErrorLog(MethodBase.GetCurrentMethod().Name, Common.GetStringWithoutQuate(ex.Message), "Error while displaying the Vendor Bulk Transactions Report",
"app_sabayik.get_risk_eval_lookups", null,
null,
"req.P_PERM_ID = ", "P_COMPANY_NAME = ", "P_USER = ");
Response.Write(response.StatusDesc.ToString());
}
return false;
}
}
Amira BedhiafiPosted Jan 14, 2025, 1:38 PM
I think there is an issue with you db connection details ( username, password, or database name) for one of the subreports, especially after you add a second subreport.
You need to explicitly set the connection details for the subreport, especially if the subreport uses a different database or schema than the main report :
you are manually setting the data source for the main report and subreports so double-check that the
SetDataSourcemethod for the subreport is called after the data is populated in the dataset, and that it maps correctly to the relevant table or dataset.Try clearing the report cache and refreshing the database connections because ometimes cached connection information can cause issues, especially when you add or modify subreports.