I keep getting the following error when I try to add new record into database (Access 2007)
"The INSERT INTO statement contain unknown field name:'login'."
I dont whats wrong as the coding looks fine and the field login does exist in the database. Spent whole day trying to find the solution, hope someone here can help me.
this are my coding
Imports System.Data.OleDb
Public Class Form1
Dim connstr, strSQL As String
Dim myconnection As OleDbConnection
Dim mycommand As OleDbCommand
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
connstr = "Provider=microsoft.jet.oledb.4.0;data source=C:\Users\Rizal\Documents\Visual Studio 2008\Projects\login\login\login.mdb"
myconnection = New OleDbConnection(connstr)
strSQL = "INSERT INTO Table1 ([login],[Pass]) VALUES ('" & TextBox1.Text & "','" & TextBox2.Text & "')"
myconnection.Open()
mycommand = New OleDbCommand(strSQL, myconnection)
mycommand.ExecuteNonQuery()
myconnection.Close()
MessageBox.Show("Data Saved")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub