J
Justin Musick
I'm having some trouble inserting a record into a SQL database from a simple
form. When the "txtName" text box is filled and the button is clicked, I
get no error but no record is added to the database.
My code is:
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
Dim insertCmd As String = "INSERT INTO tblCustomer (cusName) VALUES
(@cusName)"
Dim insertWO As SqlCommand
daWO.Fill(DsWO1)
insertWO = New SqlCommand(insertCmd, cnnWO)
insertWO.Parameters.Add(New SqlParameter("@cusName", SqlDbType.NVarChar,
50))
insertWO.Parameters("@cusName").Value = txtName.Text
insertWO.Connection.Open()
'Sends user to success page once data successfully is entered
Response.Redirect("wosuccess.htm")
End Sub
form. When the "txtName" text box is filled and the button is clicked, I
get no error but no record is added to the database.
My code is:
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSubmit.Click
Dim insertCmd As String = "INSERT INTO tblCustomer (cusName) VALUES
(@cusName)"
Dim insertWO As SqlCommand
daWO.Fill(DsWO1)
insertWO = New SqlCommand(insertCmd, cnnWO)
insertWO.Parameters.Add(New SqlParameter("@cusName", SqlDbType.NVarChar,
50))
insertWO.Parameters("@cusName").Value = txtName.Text
insertWO.Connection.Open()
'Sends user to success page once data successfully is entered
Response.Redirect("wosuccess.htm")
End Sub