well after searching ans coming up with nothing i figured id post something in here to see if i could get some help. i have an access db that keeps track of flights that ive flown. its a logbook basically. now im writing a program to add to that database and for some reason it keeps giving me "Syntax error in INSERT INTO statement" when it comes to the dataadapter.upd ate method. here is the code, i will also include a link to the code with all the goodies highlighted. can someone tell me what im doing wrong? pretty please. hah.
Public Class frmVerifyFlight
Private m_cnADONetConne ction As New OleDb.OleDbConn ection()
Private m_daDataAdapter As OleDb.OleDbData Adapter
Private m_cbCommandBuil der As OleDb.OleDbComm andBuilder
Private m_dtlogbook As New DataTable
Private m_rowposition As Integer = m_dtlogbook.Row s.Count
Private Sub frmVerifyFlight _FormClosed(ByV al sender As Object, ByVal e As System.Windows. Forms.FormClose dEventArgs) Handles Me.FormClosed
m_cnADONetConne ction.Close()
m_cnADONetConne ction.Dispose()
End Sub
Private Sub frmAddFlight_Lo ad(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
m_cnADONetConne ction.Connectio nString = _
"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=c:\logbo ok\db1.mdb"
m_cnADONetConne ction.Open()
m_daDataAdapter = _
New OleDb.OleDbData Adapter("Select * from logbook", m_cnADONetConne ction)
m_cbCommandBuil der = New OleDb.OleDbComm andBuilder(m_da DataAdapter)
m_daDataAdapter .Fill(m_dtlogbo ok)
If txttotal.Text > 24 Then
MessageBox.Show ("You can not log more than 24hrs in a day", "Errors Found", MessageBoxButto ns.OK, MessageBoxIcon. Error)
frmchangeinfo.S howDialog()
End If
End Sub
Private Sub btnNo_Click(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles btnNo.Click
frmchangeinfo.S howDialog()
End Sub
Private Sub btnAbort_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnAbort.Click
Me.Close()
End Sub
Private Sub rbNo_CheckedCha nged(ByVal sender As System.Object, ByVal e As System.EventArg s)
End Sub
Private Sub rbYes_CheckedCh anged(ByVal sender As System.Object, ByVal e As System.EventArg s)
End Sub
Private Sub lblcombat_Click (ByVal sender As System.Object, ByVal e As System.EventArg s)
End Sub
Private Sub lblDescription_ Click(ByVal sender As System.Object, ByVal e As System.EventArg s)
End Sub
Private Sub txtdescription_ TextChanged(ByV al sender As System.Object, ByVal e As System.EventArg s)
End Sub
Private Sub btnYes_Click(By Val sender As System.Object, ByVal e As System.EventArg s) Handles btnYes.Click
Dim drNewRow As DataRow = m_dtlogbook.New Row()
drNewRow("FltDa te") = txtdate.Text
drNewRow("Aircr aft") = txtAircraft.Tex t
drNewRow("Day") = txtDay.Text
drNewRow("Night ") = txtnight.Text
drNewRow("NVD") = txtnvd.Text
drNewRow("Hood" ) = txthood.Text
drNewRow("Total Time") = txttotal.Text
drNewRow("Descr iption") = txtdescription. Text
drNewRow("Comba t") = rbYes.Checked
m_dtlogbook.Row s.Add(drNewRow)
m_daDataAdapter .Update(m_dtlog book)
End Sub
End Class
the column names are all listed in the last sub. thanks.
link to highlighted stuff is.......
http://www.nomorepasti ng.com/getpaste.php?pa steid=3350
thanks
Public Class frmVerifyFlight
Private m_cnADONetConne ction As New OleDb.OleDbConn ection()
Private m_daDataAdapter As OleDb.OleDbData Adapter
Private m_cbCommandBuil der As OleDb.OleDbComm andBuilder
Private m_dtlogbook As New DataTable
Private m_rowposition As Integer = m_dtlogbook.Row s.Count
Private Sub frmVerifyFlight _FormClosed(ByV al sender As Object, ByVal e As System.Windows. Forms.FormClose dEventArgs) Handles Me.FormClosed
m_cnADONetConne ction.Close()
m_cnADONetConne ction.Dispose()
End Sub
Private Sub frmAddFlight_Lo ad(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
m_cnADONetConne ction.Connectio nString = _
"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=c:\logbo ok\db1.mdb"
m_cnADONetConne ction.Open()
m_daDataAdapter = _
New OleDb.OleDbData Adapter("Select * from logbook", m_cnADONetConne ction)
m_cbCommandBuil der = New OleDb.OleDbComm andBuilder(m_da DataAdapter)
m_daDataAdapter .Fill(m_dtlogbo ok)
If txttotal.Text > 24 Then
MessageBox.Show ("You can not log more than 24hrs in a day", "Errors Found", MessageBoxButto ns.OK, MessageBoxIcon. Error)
frmchangeinfo.S howDialog()
End If
End Sub
Private Sub btnNo_Click(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles btnNo.Click
frmchangeinfo.S howDialog()
End Sub
Private Sub btnAbort_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnAbort.Click
Me.Close()
End Sub
Private Sub rbNo_CheckedCha nged(ByVal sender As System.Object, ByVal e As System.EventArg s)
End Sub
Private Sub rbYes_CheckedCh anged(ByVal sender As System.Object, ByVal e As System.EventArg s)
End Sub
Private Sub lblcombat_Click (ByVal sender As System.Object, ByVal e As System.EventArg s)
End Sub
Private Sub lblDescription_ Click(ByVal sender As System.Object, ByVal e As System.EventArg s)
End Sub
Private Sub txtdescription_ TextChanged(ByV al sender As System.Object, ByVal e As System.EventArg s)
End Sub
Private Sub btnYes_Click(By Val sender As System.Object, ByVal e As System.EventArg s) Handles btnYes.Click
Dim drNewRow As DataRow = m_dtlogbook.New Row()
drNewRow("FltDa te") = txtdate.Text
drNewRow("Aircr aft") = txtAircraft.Tex t
drNewRow("Day") = txtDay.Text
drNewRow("Night ") = txtnight.Text
drNewRow("NVD") = txtnvd.Text
drNewRow("Hood" ) = txthood.Text
drNewRow("Total Time") = txttotal.Text
drNewRow("Descr iption") = txtdescription. Text
drNewRow("Comba t") = rbYes.Checked
m_dtlogbook.Row s.Add(drNewRow)
m_daDataAdapter .Update(m_dtlog book)
End Sub
End Class
the column names are all listed in the last sub. thanks.
link to highlighted stuff is.......
http://www.nomorepasti ng.com/getpaste.php?pa steid=3350
thanks
Comment