Wednesday, August 13, 2008

Update Command

Update Command
 
Add a Button control to the Web Forms page and paste the following code.
Private Sub Update_Click(ByVal sender As System.Object, ByVal e As_
System.EventArgs) Handles Update.Click
Try
myConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;_
Data Source=C:\eshwar\books.mdb;")
myConn.Open()
myComm = New OleDbCommand("Update Table1 Set Publisher='MSR'_
where publisher='McGraw Hill'", myConn)
Dim sa As Integer = myComm.ExecuteNonQuery()
Response.Write("Records updated" & " " & sa)
Catch
End Try
End Sub

No comments: