Некоторые параметры или учетные данные не были указаны (RDL C) - PullRequest
0 голосов
/ 26 января 2020

Я проверил онлайн, но, кажется, ничто не заставляет меня показывать свой отчет без этой проблемы. В моем отчете только 1 подотчет с 3 параметрами. Я также проверил правописание. Если я закомментирую часть подотчета, то я смогу увидеть отчет с ошибкой рядом с частью подотчета (что имеет смысл, поскольку я ожидаю добавления данных. Ниже приведен код. Любая идея, что мне не хватает?

private void Form2_Load (отправитель объекта, EventArgs e) {

        DataSet ds1 = DataAdapterSelectQuery("SELECT DISTINCTROW tblInvoice.*, tblInvoiceDetail.intNo, tblInvoiceDetail.memDescription, tblInvoiceDetail.dblQuantity, tblInvoiceDetail.strUnit, tblInvoiceDetail.curAmount, [dblQuantity] *[curAmount] -[curDiscount] +[curTax] AS curTotal, ([strFirstName] + ' ') & [strSirName] AS strCustomer, tblInvoice.memQRCode, [memDescription] + ('(' & [strtaxcodes] & ')') AS DetailWithTaxCodes, IIf([tblInvoice]![strVMSInvType] = 'Normal', ' ============ FISCAL INVOICE ============ ', ' ===== THIS IS NOT A FISCAL RECEIPT ===== ') AS strTop, IIf([tblInvoice]![strVMSInvType]='Normal',' ======== END OF FISCAL INVOICE ========= ',' ===== THIS IS NOT A FISCAL RECEIPT ===== ') AS strBottom, tblInvoiceDetail.curDiscount, [curTotal]/[dblQuantity] AS curUnitAfterTax FROM(tblCustomers INNER JOIN tblInvoice ON tblCustomers.strCustCode = tblInvoice.strCustCode) INNER JOIN tblInvoiceDetail ON(tblInvoice.intInvType = tblInvoiceDetail.intInvType) AND(tblInvoice.lngInvNo = tblInvoiceDetail.lngInvNo) AND(tblInvoice.strVMSInvType = tblInvoiceDetail.strVMSInvType);");
        DataTable dt1 = ds1.Tables[0];
        dt1.TableName = "DataSet1";
        this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt1));

        DataSet ds2 = DataAdapterSelectQuery("SELECT strName, memAddress, s_GUID, oleLogo, strTaxNo FROM tblSystem");
        DataTable dt2 = ds2.Tables[0];
        dt2.TableName = "DataSet2";
        this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet2", dt2));

        DataSet ds3 = DataAdapterSelectQuery("SELECT strName, memAddress, s_GUID, oleLogo, strTaxNo FROM tblSystem");
        DataTable dt3 = ds3.Tables[0];
        dt3.TableName = "DataSet3";
        this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet3", dt3));

        this.reportViewer1.RefreshReport();

        reportViewer1.LocalReport.SubreportProcessing +=
              new SubreportProcessingEventHandler(InvoiceVMSSubTaxSubreportProcessingEventHandler);

        this.reportViewer1.RefreshReport();
        reportViewer1.LocalReport.Refresh();
    }

    private DataTable GetInvoiceVMSSubTaxSubReport(int lngInvNo, int intInvType, string strVMSInvType)
    {
        DataSet dsSubReport = DataAdapterSelectQuery("SELECT tblInvoiceTax.strVMSInvType, tblInvoiceTax.lngInvNo, tblInvoiceTax.intInvType, tblInvoiceTax.strLabel, tblInvoiceTax.strName, Format(tblInvoiceTax.[dblRate], 'Fixed') & [strSuffix] AS strRate, tblInvoiceTax.curTax FROM tblTaxCodes INNER JOIN tblInvoiceTax ON tblTaxCodes.strTaxLabel = tblInvoiceTax.strLabel WHERE lngInvNo = " + lngInvNo + " AND intInvType = " + intInvType + " AND strVMSInvType = '" + strVMSInvType + "'; ");
        DataTable dtSubreport = dsSubReport.Tables[0];
        dtSubreport.TableName = "DataSet1";
        this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dtSubreport));
        return dtSubreport;
    }

    void InvoiceVMSSubTaxSubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
    {
        int lngInvNoParameter = int.Parse(e.Parameters["lngInvNoParameter"].Values[0].ToString());
        int intInvTypeParameter = int.Parse(e.Parameters["intInvTypeParameter"].Values[0].ToString());
        string strVMSInvTypeParameter = e.Parameters["strVMSInvTypeParameter"].Values[0].ToString();

        DataTable dtInvoiceVMSSubTaxSubReport = GetInvoiceVMSSubTaxSubReport(lngInvNoParameter, intInvTypeParameter, strVMSInvTypeParameter);

        ReportDataSource ds = new ReportDataSource("DataSet1", dtInvoiceVMSSubTaxSubReport);
        e.DataSources.Add(ds);

    }


    public static DataSet DataAdapterSelectQuery(string sqlQuery)
    {
        //TODO: Error Handling is left
        //TODO: Need global connection string
        string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["WindowsFormsApp2.Properties.Settings.VMS_DataConnectionString"].ConnectionString;

        //try                                   WindowsFormsApp2.Properties.Settings.VMS_DataConnectionString

        //{                

        using (OleDbConnection con = new OleDbConnection(connectionString))

        {

            con.Open();

            OleDbDataAdapter dAdapter = new OleDbDataAdapter(sqlQuery, con);

            DataSet dataSet = new DataSet();
            dAdapter.Fill(dataSet);

            return dataSet;
        }
        //catch (Exception ex)            
    }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...