Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
If btnAdd.Text = "Add" Then
btnAdd.Text = "Insert"
txtFName.Text = ""
txtLName.Text = ""
ElseIf btnAdd.Text = "Insert" Then
Dim cb As New OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("table").NewRow()
dsNewRow.Item("First_Name") = txtFName.Text
dsNewRow.Item("Last_Name") = txtLName.Text
ds.Tables("table").Rows.Add(dsNewRow)
da.Update(ds, "table")
MsgBox("Adding record success")
btnAdd.Text = "Add"
conx()
display()
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dbProvider = "PROVIDER=Microsoft.Ace.OLEDB.12.0;"
dbSource = "Data Source =" & Server.MapPath("CookiesDBase.accdb") & ""
con.ConnectionString = dbProvider & dbSource
conx()
If Request.Cookies("cookies") Is Nothing Then
Response.Cookies("cookies").Value = count
Response.Cookies("cookies").Expires = Date.Now.AddDays(2)
End If
maxrows = ds.Tables("table").Rows.Count - 1
count = Request.Cookies("cookies").Value
display()
End Sub