N
nicholas
Could someone tell me how to implement an INSERT on an aspx-page using a
stored procedure, in VB-code?
THX,
Nic
PS: I have been trying this, but it ain't working:
Sub insert_new_content (sender As Object, e As EventArgs)
Dim MyConnectionString as String =
ConfigurationSettings.AppSettings("ConnectionString")
Dim myConnection As SQLConnection
myConnection = New SQLConnection(MyConnectionString)
Dim myCommand As New SqlCommand("spaddshopscats", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
Dim Parameter As SqlParameter
Parameter = New SqlParameter("@shopID", SqlDbType.Int, 4)
myCommand.Parameters.Add(Parameter)
Parameter.Direction = ParameterDirection.Input
Parameter.Value = ctype(request.querystring("shopID"),integer)
Parameter = New SqlParameter("@categoryID", SqlDbType.VarChar, 2000)
myCommand.Parameters.Add(Parameter)
Parameter.Direction = ParameterDirection.Input
Parameter.Value = categoryID.text
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub
stored procedure, in VB-code?
THX,
Nic
PS: I have been trying this, but it ain't working:
Sub insert_new_content (sender As Object, e As EventArgs)
Dim MyConnectionString as String =
ConfigurationSettings.AppSettings("ConnectionString")
Dim myConnection As SQLConnection
myConnection = New SQLConnection(MyConnectionString)
Dim myCommand As New SqlCommand("spaddshopscats", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
Dim Parameter As SqlParameter
Parameter = New SqlParameter("@shopID", SqlDbType.Int, 4)
myCommand.Parameters.Add(Parameter)
Parameter.Direction = ParameterDirection.Input
Parameter.Value = ctype(request.querystring("shopID"),integer)
Parameter = New SqlParameter("@categoryID", SqlDbType.VarChar, 2000)
myCommand.Parameters.Add(Parameter)
Parameter.Direction = ParameterDirection.Input
Parameter.Value = categoryID.text
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub