im trying to add a new records to database access but when i click the button submit
it say's Syntax error in INSERT INTO statement, OledbException was unhandled
da.Update(ds, "MSHS") = syntax error INSERT INTO
here's my code
Public Class StudentRegistrationForm
Dim inc As Integer
Dim con As New OleDb.OleDbConnection
Dim dbprovider As String
Dim dbsource As String
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sql As String
Private Sub StudentRegistrationForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dbprovider = "Provider=Microsoft.ACE.OLEDB.12.0;"
dbsource = "Data Source=C:\MSHS.accdb"
con.ConnectionString = dbprovider & dbsource
con.Open()
sql = "SELECT * FROM Students"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "MSHS")
con.Close()
End Sub
Private Sub EXitBT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EXitBT.Click
Application.Exit()
End Sub
Private Sub SRSubmitBT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SRSubmitBT.Click
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("MSHS").NewRow()
dsNewRow.Item("Student Number") = SRStudNumTB.Text
dsNewRow.Item("First Name") = SRFirstNameTB.Text
dsNewRow.Item("Middle Name") = SRMiddleNameTB.Text
dsNewRow.Item("Last Name") = SRLastNameTB.Text
ds.Tables("MSHS").Rows.Add(dsNewRow)
da.Update(ds, "MSHS")
MsgBox("New Record added to the Database")
End Sub
End Class