Hi.
problem in where insert data into table. Using vwd 2012 and Mssql 2012. Insert command is working fine in first record. If add another record, it shows "Procedure or Function has too many argument" I have tried may way, I could not solve. Pls help me. Below is my Store Procedure, Class file and aspx.vb files.
Store Procedure
GO
/****** Object: StoredProcedure [dbo].[usp_CommonInfo_Insert] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[usp_CommonInfo_Insert]
@Code nvarchar(10) = NULL,
@Name nvarchar(100) = NULL,
@Type nvarchar(10) = NULL,
@BAddress nvarchar(150) = NULL,
@SAddress nvarchar(150) = NULL,
@Tel1 nvarchar(20) = NULL,
@Tel2 nvarchar(20) = NULL,
@Fax1 nvarchar(20) = NULL,
@Fax2 nvarchar(20) = NULL,
@Email nvarchar(30) = NULL,
@ContactName nvarchar(30) = NULL,
@ContactTel nvarchar(20) = NULL,
@BusinessNature nvarchar(50) = NULL,
@CrLt numeric(18,2) = NULL,
@Terms numeric(18,0) = NULL,
@BillType nvarchar(10) = NULL,
@OpDate datetime = NULL,
@OpBal numeric(18,2) = NULL,
@CreatedOn datetime = NULL,
@CreatedBy nvarchar(10) = NULL,
@LastUpdate datetime = NULL,
@LastUpdateBy nvarchar(10) = NULL,
@Terminal nvarchar(50) = NULL,
@UptodateSales numeric(18,2) = NULL,
@UpToDatePaid numeric(18,2) = NULL,
@PrePaid numeric(18,2) = NULL,
@Balance numeric(18,2) = NULL
As
Begin
Insert Into CommonInfo
([Code],[Name],[Type],[BAddress],[SAddress],[Tel1],[Tel2],[Fax1],[Fax2],[Email],[ContactName],[ContactTel],[BusinessNature],[CrLt],[Terms],[BillType],[OpDate],[OpBal],[CreatedOn],[CreatedBy],[LastUpdate],[LastUpdateBy],[Terminal],[UptodateSales],[UpToDatePaid],[PrePaid],[Balance])
Values
(@Code,@Name,@Type,@BAddress,@SAddress,@Tel1,@Tel2,@Fax1,@Fax2,@Email,@ContactName,@ContactTel,@BusinessNature,@CrLt,@Terms,@BillType,@OpDate,@OpBal,@CreatedOn,@CreatedBy,@LastUpdate,@LastUpdateBy,@Terminal,@UptodateSales,@UpToDatePaid,@PrePaid,@Balance)
Declare @ReferenceID int
Select @ReferenceID = @@IDENTITY
Return @ReferenceID
End
dbl_clients.vb
Public Function SaveMode(incode As String, inname As String, intype As String, inbaddress As String, insaddress As String, _
intel1 As String, intel2 As String, infax1 As String, infax2 As String, inemail As String, incontactname As String, incontacttel As String, _
inbusiness As String, incrlt As Decimal, interms As Integer, inbilltype As String, inopdate As Date, inopbal As Decimal, _
increatedOn As Date, increatedby As String, inlastupdate As String, inlastupdateby As String, interminal As String, _
inuptodatesales As Decimal, inuptodatepaid As Decimal, inprepaid As Decimal, inbalance As Decimal) As String
'SaveMode = True
SaveMode = String.Empty
Try
cmd.Connection = conn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "usp_CommonInfo_Insert"
cmd.Parameters.AddWithValue("@Code", incode)
cmd.Parameters.AddWithValue("@Name", UCase(inname))
cmd.Parameters.AddWithValue("@Type", intype)
cmd.Parameters.AddWithValue("@BAddress", inbaddress)
cmd.Parameters.AddWithValue("@SAddress", insaddress)
cmd.Parameters.AddWithValue("@Tel1", intel1)
cmd.Parameters.AddWithValue("@Tel2", intel2)
cmd.Parameters.AddWithValue("@Fax1", infax1)
cmd.Parameters.AddWithValue("@Fax2", infax2)
cmd.Parameters.AddWithValue("@Email", inemail)
cmd.Parameters.AddWithValue("@ContactName", incontactname)
cmd.Parameters.AddWithValue("@ContactTel", incontacttel)
cmd.Parameters.AddWithValue("@BusinessNature", inbusiness)
cmd.Parameters.AddWithValue("@CrLt", incrlt)
cmd.Parameters.AddWithValue("@Terms", interms)
cmd.Parameters.AddWithValue("@BillType", inbilltype)
cmd.Parameters.AddWithValue("@OpDate", inopdate)
cmd.Parameters.AddWithValue("@OpBal", inopbal)
cmd.Parameters.AddWithValue("@CreatedOn", Date.Now)
cmd.Parameters.AddWithValue("@CreatedBy", increatedby)
cmd.Parameters.AddWithValue("@LastUpdate", Date.Now)
cmd.Parameters.AddWithValue("@LastUpdateBy", increatedby)
cmd.Parameters.AddWithValue("@Terminal", interminal)
cmd.Parameters.AddWithValue("@UptodateSales", 0)
cmd.Parameters.AddWithValue("@UpToDatePaid", 0)
cmd.Parameters.AddWithValue("@PrePaid", 0)
cmd.Parameters.AddWithValue("@Balance", 0)
Dim da As New SqlDataAdapter(cmd)
Dim dt As New DataTable
da.Fill(dt)
cmd.Dispose()
conn.Close()
Catch ex As Exception
SaveMode = ex.Message.ToString
Finally
cmd.Dispose()
conn.Close()
End Try
Return SaveMode
End Function
client_ADD.aspx.vb
Private Sub SaveMode()
Dim errmsg As String
errmsg = dblClient.SaveMode(txtCode.Text, Me.txtName.Text, cboType.SelectedValue, txtBAddres.Text, txtSAddress.Text, _
txtTel1.Text, txtTel2.Text, txtFax1.Text, txtFax2.Text, txtEmail.Text, txtContactName.Text, _
"ContactTel", txtBusiness.Text, txtCrLt.Text, txtTerms.Text, cboBillType.SelectedValue, txtOPDate.Text, _
txtOPBal.Text, Date.Now, Request.Cookies("userid").Value, Date.Now, Request.Cookies("userid").Value, _
"Terminal", 0, 0, 0, 0)
If errmsg <> String.Empty Then
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Message", "alert('Error occured : " & errmsg & "');", True)
Else
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alert", "alert('Record Saved !');", True)
Response.Redirect("client_View.aspx")
End If
end sub
Pls help me