ahmed salah

ahmed salah

  • 1.1k
  • 553
  • 34k

when run crystal report i get Error in File temp_.rpt:\nUnable to conn

Jul 4 2024 8:56 PM

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;
}
}