G
Guest
Hi I have the code below and am trying to use a stored procedure that excepts 2 integer inputs
I have also attempted to create the data adapter without the wizard. The line
da.InsertCommand().Parameters("@DataItemID").Value() = tempint1 causes the run time error
***************actual code**************************************************
Dim da As New SqlDataAdapte
Dim cmd As New SqlCommand("dml$parmins_data_item_destination"
tempint = data_item_id 'data_item_id is from the previous for
dest_string = lst_bx_dest.SelectedValu
tempint1 = dest_string ' cast to intege
' tempint = lst_bx_dest.SelectedInde
With cm
cmd.Connection = Me.SqlConnection
cmd.CommandType = CommandType.StoredProcedur
cmd.Parameters.Add((New System.Data.SqlClient.SqlParameter("@DataItemID", System.Data.SqlDbType.Int, 4))
cmd.Parameters.Add((New System.Data.SqlClient.SqlParameter("@DestinationID", System.Data.SqlDbType.Int, 4))
da.InsertCommand().Parameters("@DataItemID").Value() = tempint
da.InsertCommand().Parameters("@DestinationID").Value() = tempin
da.InsertCommand = cm
End Wit
***************end code*******************************************************
I have also attempted to create the data adapter without the wizard. The line
da.InsertCommand().Parameters("@DataItemID").Value() = tempint1 causes the run time error
***************actual code**************************************************
Dim da As New SqlDataAdapte
Dim cmd As New SqlCommand("dml$parmins_data_item_destination"
tempint = data_item_id 'data_item_id is from the previous for
dest_string = lst_bx_dest.SelectedValu
tempint1 = dest_string ' cast to intege
' tempint = lst_bx_dest.SelectedInde
With cm
cmd.Connection = Me.SqlConnection
cmd.CommandType = CommandType.StoredProcedur
cmd.Parameters.Add((New System.Data.SqlClient.SqlParameter("@DataItemID", System.Data.SqlDbType.Int, 4))
cmd.Parameters.Add((New System.Data.SqlClient.SqlParameter("@DestinationID", System.Data.SqlDbType.Int, 4))
da.InsertCommand().Parameters("@DataItemID").Value() = tempint
da.InsertCommand().Parameters("@DestinationID").Value() = tempin
da.InsertCommand = cm
End Wit
***************end code*******************************************************