table insertion error

table insertion error

Page 1 of 1

1 Replies - 1114 Views - Last Post: 18 December 2007 - 03:50 PM Rate Topic: -----

#1 davincinewfie  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-December 07

table insertion error

Post icon  Posted 15 December 2007 - 07:08 PM

oledbexception was unhandled....syntax error in insert into statement is the error I get I can edit/update information, delete and everything except for add

the cmdSave code is::::

Dim drNewRow As DataRow = m_dtTable1.NewRow()

With Me
drNewRow("id") = .txtid.Text
drNewRow("Date") = .txtdate.Text
drNewRow("Time") = .txttime.Text
drNewRow("CallSign") = .txtcallsign.Text
drNewRow("Freq") = .txtfreq.Text
drNewRow("Mode") = .txtmode.Text
drNewRow("RST") = .txtrst.Text
drNewRow("Notes") = .txtnotes.Text
drNewRow("QslTX") = .txtqsltx.Text
drNewRow("QslRX") = .txtqslrx.Text
End With

m_dtTable1.Rows.Add(drNewRow)
m_daTable1.Update(m_dtTable1) <<<<-----ERROR HERE

m_intRowPosition = m_dtTable1.Rows.Count - 1

m_blnNewRecord = False
m_blnUpdateRecord = False

ShowCurrentRecord()


----------------------------------------------------------------

declarations:::
Public m_cnTable1 As New OleDb.OleDbConnection
Public m_daTable1 As OleDb.OleDbDataAdapter
Public m_cbTable1 As OleDb.OleDbCommandBuilder
Public m_dtTable1 As New DataTable
Public m_intRowPosition As Integer = 0
Public m_blnNewRecord As Boolean = False
Public m_blnUpdateRecord As Boolean = False


----------------------------------------------------------------

I can post full code if need be but I figured going through that much might be enough

Is This A Good Question/Topic? 0
  • +

Replies To: table insertion error

#2 fathiytemimi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-November 07

Re: table insertion error

Posted 18 December 2007 - 03:50 PM

Try this:

m_dtTable1.Rows.Add(drNewRow) <--- first Addnew

With Me
drNewRow("id") = .txtid.Text
drNewRow("Date") = .txtdate.Text
drNewRow("Time") = .txttime.Text
drNewRow("CallSign") = .txtcallsign.Text
drNewRow("Freq") = .txtfreq.Text
drNewRow("Mode") = .txtmode.Text
drNewRow("RST") = .txtrst.Text
drNewRow("Notes") = .txtnotes.Text
drNewRow("QslTX") = .txtqsltx.Text
drNewRow("QslRX") = .txtqslrx.Text
End With

m_daTable1.Update(m_dtTable1) <---- Then Update

Let me Know!



View Postdavincinewfie, on 15 Dec, 2007 - 08:08 PM, said:

oledbexception was unhandled....syntax error in insert into statement is the error I get I can edit/update information, delete and everything except for add

the cmdSave code is::::

Dim drNewRow As DataRow = m_dtTable1.NewRow()

With Me
drNewRow("id") = .txtid.Text
drNewRow("Date") = .txtdate.Text
drNewRow("Time") = .txttime.Text
drNewRow("CallSign") = .txtcallsign.Text
drNewRow("Freq") = .txtfreq.Text
drNewRow("Mode") = .txtmode.Text
drNewRow("RST") = .txtrst.Text
drNewRow("Notes") = .txtnotes.Text
drNewRow("QslTX") = .txtqsltx.Text
drNewRow("QslRX") = .txtqslrx.Text
End With

m_dtTable1.Rows.Add(drNewRow)
m_daTable1.Update(m_dtTable1) <<<<-----ERROR HERE

m_intRowPosition = m_dtTable1.Rows.Count - 1

m_blnNewRecord = False
m_blnUpdateRecord = False

ShowCurrentRecord()


----------------------------------------------------------------

declarations:::
Public m_cnTable1 As New OleDb.OleDbConnection
Public m_daTable1 As OleDb.OleDbDataAdapter
Public m_cbTable1 As OleDb.OleDbCommandBuilder
Public m_dtTable1 As New DataTable
Public m_intRowPosition As Integer = 0
Public m_blnNewRecord As Boolean = False
Public m_blnUpdateRecord As Boolean = False


----------------------------------------------------------------

I can post full code if need be but I figured going through that much might be enough

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1