Notice my big thumbs down.
So, why the HECK wont this work@@!@#E
the two Arrays are private fields (arraylists actually) in the class (I use a method to fill them, the values are correct...argh!)
Here is the stored proc
[sql]
CREATE PROC sp_AddCustomer @cname varchar(100),@addr varchar(150),@city varchar(100),@st varchar(4),@zip varchar(12) as INSERT INTO custinf (cname,addr,city,st,zip) VALUES (@cname , @addr, @city, @st, @zip)
[/sql]
So, why the HECK wont this work@@!@#E
the two Arrays are private fields (arraylists actually) in the class (I use a method to fill them, the values are correct...argh!)
Here is the stored proc
[sql]
CREATE PROC sp_AddCustomer @cname varchar(100),@addr varchar(150),@city varchar(100),@st varchar(4),@zip varchar(12) as INSERT INTO custinf (cname,addr,city,st,zip) VALUES (@cname , @addr, @city, @st, @zip)
[/sql]
Code:
Public Overloads Sub InitCmd()
Dim hold As String
Dim num As Integer = MarrParmVal.Count - 1
MSQLCmd = New SqlClient.SqlCommand(MSp, m_SQLcn)
m_SQLcn.Open()
MSQLCmd.CommandType = CommandType.StoredProcedure
Dim i As Int32
For i = 0 To num
hold = MarrParmVal(i).GetType.ToString
Select Case hold
Case "System.Int32"
MSQLCmd.Parameters.Add(MarrParm(i), SqlDbType.Int)
Case "System.String"
MSQLCmd.Parameters.Add(MarrParm(i), SqlDbType.VarChar)
Case Else
End Select
MSQLCmd.Parameters(MarrParm(i)).Value = MarrParmVal(i)
Next
Try
MSQLCmd.ExecuteNonQuery()
Catch eos As System.Data.SqlClient.SqlException
ErrHandle(eos.Number)
End Try
m_SQLcn.Close()
End Sub
Last edited by a moderator: