Norwahida Shamsuddin Norwahida Shamsuddin - 3 months ago 29 Question

Updating SQL database using

I try to update database in MS SQL in ASP using VB.NET. This is my code. There is no error but the data in database are not updated

Dim cnConnect As New SqlConnection
cnConnect.ConnectionString = conn.ConnectionString
Dim cm As New SqlCommand
cm.CommandText = "UPDATE book SET name = '" & name.Text & "'
WHERE idnum = '" & idno.Text & "';"
cm.Connection = cnConnect


I think you missed to execute the query. You may have to execute the query before closing the connection like this,