Good day,
when i run my project, this error appears in my catch "Procedure or function sp_CreditNoteGSTInsert has too many arguments specified."
////this is my vb code:
Public Function InsertCommandCreditNote(ByVal strCreditNoteNo As String, ByVal strCreditNoteDate As String, _
ByVal strBranchCode As String, ByVal strCustomerAccNo As String, ByVal strCustomer As String, _
ByVal strInvoiceNo As String, ByVal intInvoiceID As Integer, _
ByVal totalAmount As Double, ByVal guidUserID As Guid, ByVal roundAdjustment As Double) As Integer
Dim result As Integer = 0
Try
Dim conn As New SqlConnection(conStrBuilder.ConnectionString)
conn.Open()
Dim myCommand As New SqlCommand
myCommand = New SqlCommand("sp_CreditNoteGSTInsert", conn)
myCommand.CommandType = CommandType.StoredProcedure
Dim myParamCreditNoteNo As New SqlParameter
myParamCreditNoteNo = New SqlParameter("strCreditNoteNo", SqlDbType.NVarChar, 25)
myParamCreditNoteNo.Value = strCreditNoteNo
myParamCreditNoteNo.Direction = ParameterDirection.Input
Dim myParamCreditNoteDate As New SqlParameter
myParamCreditNoteDate = New SqlParameter("dteCreditNoteDate", SqlDbType.DateTime)
myParamCreditNoteDate.Value = strCreditNoteDate
myParamCreditNoteDate.Direction = ParameterDirection.Input
Dim myParamBranchCode As New SqlParameter
myParamBranchCode = New SqlParameter("strBranchCode", SqlDbType.NChar, 10)
myParamBranchCode.Value = strBranchCode
myParamBranchCode.Direction = ParameterDirection.Input
Dim myParamCustomerAccNo As New SqlParameter
myParamCustomerAccNo = New SqlParameter("strCustomerAccNo", SqlDbType.NVarChar, 30)
myParamCustomerAccNo.Value = strCustomerAccNo
myParamCustomerAccNo.Direction = ParameterDirection.Input
Dim myParamCustomer As New SqlParameter
myParamCustomer = New SqlParameter("strCustomer", SqlDbType.NVarChar, 80)
myParamCustomer.Value = strCustomer
myParamCustomer.Direction = ParameterDirection.Input
Dim myParamInvoiceID As New SqlParameter
myParamInvoiceID = New SqlParameter("intInvoiceID", SqlDbType.Int)
myParamInvoiceID.Value = intInvoiceID
myParamInvoiceID.Direction = ParameterDirection.Input
Dim myParamTotalAmount As New SqlParameter
myParamTotalAmount = New SqlParameter("dblCreditNoteTotalAmount", SqlDbType.Money)
myParamTotalAmount.Value = totalAmount
myParamTotalAmount.Direction = ParameterDirection.Input
Dim myParamguidUserID As New SqlParameter
myParamguidUserID = New SqlParameter("guidUserID", SqlDbType.UniqueIdentifier)
myParamguidUserID.Value = guidUserID
myParamguidUserID.Direction = ParameterDirection.Input
Dim myParamRoundAdjustment As New SqlParameter
myParamRoundAdjustment = New SqlParameter("dblroundadj", SqlDbType.Money)
myParamRoundAdjustment.Value = roundAdjustment
myParamRoundAdjustment.Direction = ParameterDirection.Input
myCommand.Parameters.Add(myParamCreditNoteNo)
mycommand.Parameters.Add(myParamCreditNoteDate)
mycommand.Parameters.Add(myParamBranchCode)
mycommand.Parameters.Add(myParamCustomerAccNo)
mycommand.Parameters.Add(myParamCustomer)
mycommand.Parameters.Add(myParamInvoiceID)
mycommand.Parameters.Add(myParamTotalAmount)
mycommand.Parameters.Add(myParamguidUserID)
mycommand.Parameters.Add(myParamRoundAdjustment)
Dim mySqlDataAdapter As SqlDataAdapter
mySqlDataAdapter = New SqlDataAdapter(myCommand)
Dim myDataSet As New DataSet
mySqlDataAdapter.Fill(myDataSet, "tblCreditNote")
conn.Close()
result = 1
Catch ex As Exception
objTracer.WriteToLog(ex.ToString())
End Try
Return result
End Function
///and this is my store procedure:
ALTER PROCEDURE [dbo].[sp_CreditNoteGSTInsert]
@strCreditNoteNo nvarchar(25),
@dteCreditNoteDate datetime,
@strBranchCode nchar(10),
@strCustomerAccNo nvarchar(30),
@strCustomer nvarchar(80),
@intInvoiceID int,
@dblCreditNoteTotalAmount money,
@guidUserID uniqueidentifier
AS
BEGIN
SET NOCOUNT ON;
DECLARE @TotalPayment AS MONEY
SET @TotalPayment = (SELECT SUM(round(Total,2)) FROM tblCreditNoteDetails_GST WHERE CreditNote_No = @strCreditNoteNo AND IsDeleted = 0)
INSERT INTO tblCreditNote(
CreditNote_No
,CreditNote_Date
,CreditNote_Branch_Code
,Customer_Acc_No
,Customer_Name
,Invoice_No
,CreditNote_Total_Amount
,IsDeleted
,SysCreatedBy
,SysCreatedOn
)
VALUES
(
@strCreditNoteNo
,@dteCreditNoteDate
,@strBranchCode
,@strCustomerAccNo
,@strCustomer
,@intInvoiceID
,@dblCreditNoteTotalAmount
,0
,@guidUserID
,GETDATE()
)
any suggestion how can i fix this error?
Thank you very much.
What I have tried:
i did try to use this method but still return me error.
vb.net - Procedure or Function has Too many arguments specified - Stack Overflow[
^]