bluejaguar456
Well-known member
- Joined
- Aug 22, 2006
- Messages
- 47
Hey Guys,
I am getting an error message when trying to add some information to my database.
I keep getting the, syntax error in insert into statement
Below is my code:
Please could you identify my problem is possible thanks.
I am getting an error message when trying to add some information to my database.
I keep getting the, syntax error in insert into statement
Below is my code:
Code:
Public Class Form1
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("Users").NewRow()
dsNewRow.Item("frst123") = txtfirstname.Text
ds.Tables("Users").Rows.Add(dsNewRow)
da.Update(ds, "Users")
MsgBox("New Record added to the Database")
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\Eddy\My Documents\users.mdb"
con.Open()
sql = "SELECT * FROM Users"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Users")
txtfirstname.Text = ds.Tables("Users").Rows(0).Item(0)
End Sub
End Class
Please could you identify my problem is possible thanks.