Syntax error in INSERT INTO statement - am I using a reserved word?

OMRebel

Active member
Joined
Sep 27, 2006
Messages
44
Programming Experience
Beginner
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
 
It would help if you could actually post the text of the INSERT statement itself..

Alternately, for the modern way of doing data access, check out microsoft's tutorials; the DW2 link in my signature will take you there :D
 
Back
Top