How to ADD a record in a MS access
Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\VB.net\addressbook\bin\AddressBook.mdb;Persist Security Info=True")
Dim sql As String = String.Empty
'determine if we are adding a new record or editing an
'existing record based on the value of the _contactID
'Variable
If _contactID = 0 Then
'Adding a new record
'Error is coming in the below insert statement
sql = "insert into Contacts(Title,FirstName,LastName)" & "values(" '&txtTitle.text&'","'&txtFirstName.text&'","'&txtLastName.text&'")""
End If
'Open the connection to the databaes and execute the
'SQL Statement
conn.Open()
Dim command As New OleDbCommand(sql, conn)
command.ExecuteNonQuery()
conn.Close()
'close the form
Me.Close()
End Sub

