My SQL Server stored procedure is
ALTER PROCEDURE [dbo].[usp_updateBInfo]
@WhatTheyDo nVARCHAR(max),
@WhereTheyDo nVARCHAR(max),
@ID varchar
AS
begin
update tblBInfo
set
WhatTheyDo = @WhatTheyDo,
WhereTheyDo = @WhereTheyDo
where
ID = @ID
end
My VB code is
Dim SQLCONN As New SqlConnection
SQLCONN = New SqlConnection("Data Source=xxxxxx;Initial Catalog=xxxxx;Integrated Security=True")
Dim SQLCMD As New SqlCommand("usp_updateBInfo", SQLCONN)
SQLCMD.CommandType = CommandType.StoredProcedure
SQLCMD.Parameters.Add("@ID", SqlDbType.VarChar).Value = "1C485D2C-F34D-45CE-8694-C74445DD108D"
SQLCMD.Parameters.AddWithValue("@WhatTheyDo", "abcdefg")
SQLCMD.Parameters.Add("@WhereTheyDo", SqlDbType.NVarChar).Value = "abcdefg"
SQLCMD.Connection.Open()
SQLCMD.ExecuteNonQuery()
SQLCMD.Connection.Close()
When I hit the "update" button, no change occurs, abcdefg is not passed to whattheydo or wheretheydo with primary key 1C485D2C-F34D-45CE-8694-C74445DD108D
May I ask where is wrong with my code? I'm pretty sure the button is linked to VB code.
Thanks for any suggestions!