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.update 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_cnADONetConnection As New OleDb.OleDbConnection()
Private m_daDataAdapter As OleDb.OleDbDataAdapter
Private m_cbCommandBuilder As OleDb.OleDbCommandBuilder
Private m_dtlogbook As New DataTable
Private m_rowposition As Integer = m_dtlogbook.Rows.Count
Private Sub frmVerifyFlight_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
m_cnADONetConnection.Close()
m_cnADONetConnection.Dispose()
End Sub
Private Sub frmAddFlight_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
m_cnADONetConnection.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\logbook\db1.mdb"
m_cnADONetConnection.Open()
m_daDataAdapter = _
New OleDb.OleDbDataAdapter("Select * from logbook", m_cnADONetConnection)
m_cbCommandBuilder = New OleDb.OleDbCommandBuilder(m_daDataAdapter)
m_daDataAdapter.Fill(m_dtlogbook)
If txttotal.Text > 24 Then
MessageBox.Show("You can not log more than 24hrs in a day", "Errors Found", MessageBoxButtons.OK, MessageBoxIcon.Error)
frmchangeinfo.ShowDialog()
End If
End Sub
Private Sub btnNo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNo.Click
frmchangeinfo.ShowDialog()
End Sub
Private Sub btnAbort_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAbort.Click
Me.Close()
End Sub
Private Sub rbNo_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub rbYes_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub lblcombat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub lblDescription_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub txtdescription_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub btnYes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnYes.Click
Dim drNewRow As DataRow = m_dtlogbook.NewRow()
drNewRow("FltDate") = txtdate.Text
drNewRow("Aircraft") = txtAircraft.Text
drNewRow("Day") = txtDay.Text
drNewRow("Night") = txtnight.Text
drNewRow("NVD") = txtnvd.Text
drNewRow("Hood") = txthood.Text
drNewRow("TotalTime") = txttotal.Text
drNewRow("Description") = txtdescription.Text
drNewRow("Combat") = rbYes.Checked
m_dtlogbook.Rows.Add(drNewRow)
m_daDataAdapter.Update(m_dtlogbook)
End Sub
End Class
the column names are all listed in the last sub. thanks.
link to highlighted stuff is.......
http://www.nomorepasting.com/getpaste.php?pasteid=3350
thanks