Norwahida Shamsuddin Norwahida Shamsuddin - 1 year ago 125 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

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download