Vb.net 未为私有子对象中的参数指定参数

Vb.net 未为私有子对象中的参数指定参数,vb.net,Vb.net,它正在抛出未为私有子InsertTempFile的parameterReceiptTotal指定的错误参数: 请帮帮我 Private Sub Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click Dim StrConn As String = My.Settings.ANOCS Dim CN = New SqlConnection(Str

它正在抛出未为私有子InsertTempFile的parameterReceiptTotal指定的错误参数: 请帮帮我

Private Sub Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearch.Click

    Dim StrConn As String = My.Settings.ANOCS
    Dim CN = New SqlConnection(StrConn)
    Dim FromDate As Date = FromDateDateTimePicker.Value
    Dim ToDate As Date = ToDateDateTimePicker.Value


    InsertTempFile()

    Modws.DisplayDataGrid(dgvClosingBalance, "Select Customer, Sum(RptTempTable.INVOICETOTAL) As [Invoice Total], Sum(RptTempTable.CNTOTAL) As [CN Total], Sum(RptTempTable.DEBITTOTAL) As [DN Total], Sum(RptTempTable.RECEIPTTOTAL) As [Receipt Total] From RptTempTable group by Customer")

End Sub
InsertTempFile代码:

Private Sub InsertTempFile(ByVal CUSTOMER As String, ByVal INVOICETOTAL As String, ByVal DEBITTOTAL As String, ByVal RECEIPTTOTAL As String, ByVal CNTOTAL As String)

    Dim FromDate As Date = FromDateDateTimePicker.Value
    Dim ToDate As Date = ToDateDateTimePicker.Value

    Modws.UpdateItem("Insert into RptTempTable(RECEIPTTOTAL) select Debtor,Sum(Matching.Amt) from Matching left join receipt on receipt.pkey = matching.crpk left join invoice on invoice.Pkey = matching.drpk" + _
                    " where invoice.transdate between '" & FromDate & "' and '" & ToDate & "' and receipt.transdate between '" & FromDate & "' and '" & ToDate & "' and drtype = 12 and crtype = 7 group by matching.debtor")

    Modws.UpdateItem("Insert into RptTempTable(CNTOTAL) Select Debtor,Sum(AMT) from Matching left join CREDITNOTE on CREDITNOTE.Pkey = Matching.CRPK left join Invoice on Invoice.Pkey = Matching.DRPK" + _
                    " where Invoice.TRANSDATE  between '" & FromDate & "' and '" & ToDate & "' and CREDITNOTE.CNDATE between '" & FromDate & "' and '" & ToDate & "' and drtype = 12 and crtype = 8 group by Matching.Debtor")

    Modws.UpdateItem("Insert into RptTempTable(DEBITTOTAL) Select Debtor,Sum(AMT) from Matching left join DEBITNOTE on DEBITNOTE.Pkey = Matching.CRPK left join Invoice on Invoice.Pkey = Matching.DRPK" + _
                    " where Invoice.TRANSDATE  between '" & FromDate & "' and '" & ToDate & "' and DEBITNOTE.DNDATE between '" & FromDate & "' and '" & ToDate & "'  and drtype = 12 and crtype = 6 group by Matching.Debtor")

    Modws.UpdateItem("Insert into RptTempTable(INVOICETOTAL) Select Debtor,Sum(AMT) from Matching left join INVOICE on INVOICE.Pkey = Matching.CRPK" + _
                    " where Invoice.TRANSDATE  between '" & FromDate & "' and '" & ToDate & "' and drtype = 12 and crtype = 12 group by Matching.Debtor")

End Sub

这里是一个解决方案,您只需要从方法中删除参数。您的搜索单击方法将保持不变

    Private Sub InsertTempFile()

    Dim FromDate As Date = FromDateDateTimePicker.Value
    Dim ToDate As Date = ToDateDateTimePicker.Value

    Modws.UpdateItem("Insert into RptTempTable(RECEIPTTOTAL) select Debtor,Sum(Matching.Amt) from Matching left join receipt on receipt.pkey = matching.crpk left join invoice on invoice.Pkey = matching.drpk" + _
                    " where invoice.transdate between '" & FromDate & "' and '" & ToDate & "' and receipt.transdate between '" & FromDate & "' and '" & ToDate & "' and drtype = 12 and crtype = 7 group by matching.debtor")

    Modws.UpdateItem("Insert into RptTempTable(CNTOTAL) Select Debtor,Sum(AMT) from Matching left join CREDITNOTE on CREDITNOTE.Pkey = Matching.CRPK left join Invoice on Invoice.Pkey = Matching.DRPK" + _
                    " where Invoice.TRANSDATE  between '" & FromDate & "' and '" & ToDate & "' and CREDITNOTE.CNDATE between '" & FromDate & "' and '" & ToDate & "' and drtype = 12 and crtype = 8 group by Matching.Debtor")

    Modws.UpdateItem("Insert into RptTempTable(DEBITTOTAL) Select Debtor,Sum(AMT) from Matching left join DEBITNOTE on DEBITNOTE.Pkey = Matching.CRPK left join Invoice on Invoice.Pkey = Matching.DRPK" + _
                    " where Invoice.TRANSDATE  between '" & FromDate & "' and '" & ToDate & "' and DEBITNOTE.DNDATE between '" & FromDate & "' and '" & ToDate & "'  and drtype = 12 and crtype = 6 group by Matching.Debtor")

    Modws.UpdateItem("Insert into RptTempTable(INVOICETOTAL) Select Debtor,Sum(AMT) from Matching left join INVOICE on INVOICE.Pkey = Matching.CRPK" + _
                    " where Invoice.TRANSDATE  between '" & FromDate & "' and '" & ToDate & "' and drtype = 12 and crtype = 12 group by Matching.Debtor")

End Sub
InsertTempFile过程应如下所示:

    Private Sub InsertTempFile()
    ...

    End Sub

错误在InsertTempFile中,该文件需要以下参数:CUSTOMER ByVal作为字符串、ByVal InvoiceTotal作为字符串、ByVal DebiTotal作为字符串、ByVal RECEIPTTOTAL作为字符串、ByVal CntTotal作为过程InsertTempFile中的字符串。如果不使用这些参数,可以从过程定义中删除它们。如何操作?如何修改代码?将私有子插件tempfilebyval CUSTOMER更改为String,将ByVal INVOICETOTAL更改为String,将ByVal DEBITTOTAL更改为String,将ByVal RECEIPTTOTAL更改为String,ByVal CNTOTAL As String to Private Sub InsertTempFile,因为您没有使用它们。非常感谢,它现在工作,但当我运行查询时,它显示char数据类型到datetime数据类型值的转换超出范围。非常感谢,它现在工作,但当我运行查询时,它显示char数据类型到datetime数据类型的转换值超出了范围非常感谢,它现在已经工作了,但是当我运行查询时,它显示char数据类型到datetime数据类型值的转换超出了范围