All,
THis is confusing, but I am probably missing something very obvious. When this code is executed, the debug locals show the command text to have values (CID=19, Custfnu=brian, etc...) but the information is not written to the DB.. It is my understanding that with the string and the connection in the declaration, I do not need the ExecuteNonQuery statement. Is this correct? WHy is it not working?
Here is the code...
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim SQLCN As New SqlClient.SqlConnection("Server=ICS-SVR1;User ID=sa;Password=;Database=ICS-DISPATCH")
SQLCN.Close()
SQLCN.Open()
Dim SqlDataAdapter1 As New SqlDataAdapter("UPDATE custdb SET custfn=" & "" & custfnu.Text & " , " & "custln= " & custlnu.Text & " ," & "custcn= " & custcnu.Text & ", " & "custadd1=" & custadd1u.Text & " , " & "custadd2=" & custadd2u.Text & " , " & "custcity=" & custcityu.Text & " , " & "custst= " & "" & custstu.Text & ", " & "custZIP=" & custzipu.Text & ", " & "custph=" & custphu.Text & ", " & "custnote=" & CustNoteu.Text & " " & "WHERE cid=" & cidu.Text & ";", SQLCN)
Me.Close()
End Sub
THis is confusing, but I am probably missing something very obvious. When this code is executed, the debug locals show the command text to have values (CID=19, Custfnu=brian, etc...) but the information is not written to the DB.. It is my understanding that with the string and the connection in the declaration, I do not need the ExecuteNonQuery statement. Is this correct? WHy is it not working?
Here is the code...
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim SQLCN As New SqlClient.SqlConnection("Server=ICS-SVR1;User ID=sa;Password=;Database=ICS-DISPATCH")
SQLCN.Close()
SQLCN.Open()
Dim SqlDataAdapter1 As New SqlDataAdapter("UPDATE custdb SET custfn=" & "" & custfnu.Text & " , " & "custln= " & custlnu.Text & " ," & "custcn= " & custcnu.Text & ", " & "custadd1=" & custadd1u.Text & " , " & "custadd2=" & custadd2u.Text & " , " & "custcity=" & custcityu.Text & " , " & "custst= " & "" & custstu.Text & ", " & "custZIP=" & custzipu.Text & ", " & "custph=" & custphu.Text & ", " & "custnote=" & CustNoteu.Text & " " & "WHERE cid=" & cidu.Text & ";", SQLCN)
Me.Close()
End Sub
Last edited by a moderator: