Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim sqlCustomerInsert, insPhone, insFirst, insLast As StringDim icount As IntegerDim con As New OleDb.OleDbConnectionDim cmd As OleDb.OleDbCommandDim dsCustomerInsert As New DataSetDim drNewRow As DataRowDim daCustomerInsert As OleDb.OleDbDataAdapter
sqlCustomerInsert = "insert into CustomerTable(Phone, First) values('" & txtPhone.Text & "', '" & txtFirst.Text & "','" & txtLast.Text & "')"
con.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L" & _"ocking Mode=1;Data Source=""C:\Databases\CustomerDB.mdb"";Jet OLEDB:Engine Type=5;" & _"Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=Fals" & _"e;persist security info=False;Extended Properties=;Mode=Share Deny None;Jet OLED" & _"B:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't " & _"Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User" & _" ID=Admin;Jet OLEDB:Global Bulk Transactions=1"daCustomerInsert = New OleDb.OleDbDataAdapter(sqlCustomerInsert, con)
Try con.Open() cmd = New OleDb.OleDbCommand(sqlCustomerInsert, con) icount = cmd.ExecuteNonQuery() MessageBox.Show(icount)Catch ex As Exception MessageBox.Show(ex.Message)End Try