im having problems i never thought i would however im trying to add two values from a form (txtAname.text & txtPword.text) in to a access table (tblUsers) using Username & Password as the fields,
when run the code breaks at executeNonQuery
and displays : An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
this is my code so far
thanks in advance:
when run the code breaks at executeNonQuery
and displays : An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
this is my code so far
thanks in advance:
VB.NET:
Dim conn As New OleDb.OleDbConnection(" Provider= Microsoft.JET.OLEDB.4.0; Data Source=db.mdb")
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
' Setup Connection Object; con will hold the connection object
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter ' Data adapter
Dim sql As String
Dim cmd As New OleDb.OleDbCommand("INSERT INTO tblusers (Username, Password)VALUES('" & txtAname.Text & "','" & txtApassword.Text & "')", conn)
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
End Sub