Insert Command
Add a Button control to the Web Forms page. Assuming you already have a connection established (refer to previous page sample) paste the following code.
Private Sub Insert_Click(ByVal sender As System.Object, ByVal e As_ System.EventArgs) Handles Insert.Click Try myConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;_ Data Source=C:\sandeep\books.mdb;") myConn.Open() myComm = New OleDbCommand("Insert into Table1 values 'ASP.NET ',_ 'McGraw Hill',192435211", myConn) Dim sa As Integer = myComm.ExecuteNonQuery() Response.Write("Records inserted" & " " & sa) myConn.Close() Catch End Try End Sub |
No comments:
Post a Comment