Update SQL server table Problem!!!

ceetee

New member
Joined
Nov 21, 2006
Messages
1
Programming Experience
Beginner
At the moment i currently retrieve data from a grid view then i go to seperate page made of text boxes so that i can edit the data brought accross from the grid view. However when firing the update sql it NEVER picks up the new data in the .text field.

It is now getting annoying. Can someone help?? Below is the source code.

Dim myConnection As New SqlConnection()
myConnection.ConnectionString = "Data Source=ORAC;Initial Catalog=ReleaseNotes;User ID=prism;Password=prism"
myConnection.Open()

Try
Dim UpdateSQL As String
UpdateSQL = "UPDATE PRODUCT SET ProductName =" & ProductName.Text
UpdateSQL &= " Where ID = " & Session.Item("MyRow").ToString()

Dim cmd As New SqlCommand(UpdateSQL, myConnection)



MsgBox(UpdateSQL)
Dim updated As Integer = cmd.ExecuteNonQuery
MsgBox(updated.ToString & "Records updated")
MsgBox("Release Note Changed", MsgBoxStyle.Information, "Release Notes")
Catch ex As Exception
MsgBox("Error inserting Records" & Err.GetException.ToString)

Finally
myConnection.Close()
End Try
Response.Redirect("default.aspx")
End Sub
 
Back
Top