Hey everyone. I'm having problems with this form. I'm gettin Syntax error in INSERT INTO statement. Last time I had this problem was because of a reserved word I was using. Can someone take a look at this code and let me know if that's the case as well?
VB.NET:
con.Open()
sql = "Select * From Ticket"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Ticket")
con.Close()
MaxRows = ds.Tables("Ticket").Rows.Count ' Stores how many rows are in the DataSet
inc = MaxRows
Dim cb As New OleDb.OleDbCommandBuilder(da) ' Command Builder
Dim dsNewRow As DataRow ' DataRow Object - needed for adding new rows to DataSet
dsNewRow = ds.Tables("Ticket").NewRow() ' Creates the new DataRow object, stores it in dsNewRow variable
dsNewRow.Item("Description") = txtDes.Text
dsNewRow.Item("Status") = cboStatus.Text
dsNewRow.Item("Priority") = cboPriority.Text
dsNewRow.Item("Department") = cboDep.Text
dsNewRow.Item("Tech") = cboTech.Text
dsNewRow.Item("Detail") = rtbDetail.Text
' TODO - dates
ds.Tables("Ticket").Rows.Add(dsNewRow) ' This method adds the Row to the DataSet
ds.Tables("Ticket").Rows(inc).Item("Description") = txtDes.Text
ds.Tables("Ticket").Rows(inc).Item("Status") = cboStatus.Text
ds.Tables("Ticket").Rows(inc).Item("Priority") = cboPriority.Text
ds.Tables("Ticket").Rows(inc).Item("Department") = cboDep.Text
ds.Tables("Ticket").Rows(inc).Item("Tech") = cboTech.Text
ds.Tables("Ticket").Rows(inc).Item("Detail") = rtbDetail.Text
' TODO - dates
da.Update(ds, "Ticket") ' This line here is what actually updates the database
MsgBox("Ticket Saved")
ds.Tables("Ticket").Rows.Clear() ' Clear out the dataset