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
2 4186 QVeen72 1,445
Recognized Expert Top Contributor
Hi,
looks like ur, m_dtlogBook is a DataTable.. I'am not very sure if Adatpter.Update Can take data table , I have always used that to update a DataSet:
dataAdapter.Upd ate(MyDataSet)
Regards
Veena
funny addition to that is that i tried the code out in another simpler program to make sure it would work. and it does. when i transfer it over to this program it doesnt like it for some reason. i dont get it. and there is only one database in the program that im trying to add info to. so i figured a datatable would work best there
Hi,
looks like ur, m_dtlogBook is a DataTable.. I'am not very sure if Adatpter.Update Can take data table , I have always used that to update a DataSet:
dataAdapter.Upd ate(MyDataSet)
Regards
Veena
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: bolidev |
last post by:
I'm new to SQL and can't figure out how to update my table
(StoreItemStatus) that contains the current status for items in each
store (STORE_KEY, ITEM_KEY, STATUS,...).
I get updated status info in a table (I'll call it NewInfo) that
has similar fields. NewInfo may contain multiple records for each
Store/Item, but I will just use the latest status. I'm not sure how
to update StoreItemStatus using each record of NewInfo. Any advice is...
|
by: Bob Stearns |
last post by:
The statement:
merge into nullid.animals_et_in t1 using is3.animals t2
on t1.sire_assoc=t2.assoc and t1.sire_prefix=t2.prefix and
t1.sire_regnum=t2.regnum
when matched then update set t1.sire_bhid=t2.bhid
when not matched then update set t1.sire_bhid=0
go
gets the error message:
|
by: William |
last post by:
i am using a dataset and a DataAdapter to update a table with the
following schema:
ResourceID
ProjectID
LastName
FirstName
Year
Nov
Dec
Jan
|
by: kosta |
last post by:
hello! one of my forms communicates with a database, and is
supposed to add a row to a table using an Insert
statement... however, I get a 'oledb - syntax error'
exception... I have double checked, and the insert works
fine (tried to use it from access)... im using visual C#
express 2k5... what could be wrong? thanks!
|
by: Troy |
last post by:
We recently installed the .Net framework on a windows 2000 server.
Shortly after that we experienced intermitant problems running a web
based program that accesses an Access 2002 database.
The intranet .asp program works, but as soon as it tries to access the
database for normal users, it gives us an "unspecified error" and that
it can't access the data base.
As the administrator, I found my access was relatively stable. Anyone
else...
| |
by: Jerry |
last post by:
Well, here is some weirdness. First, I noticed that I
have 2 Set keywords (silly me). so I removed the
2nd "Set" but still got a syntax error. Then I removed
the Where clause, and now it works perfectly. Is this
correct? Or am I just getting lucky? I'm not completely
clear on the fundamentals here. I update the table in my
dataset, then I update the table on the server through the
dataAdapter. I think I have a handle on the...
|
by: Scott Emick |
last post by:
I have the following datatables which are related:
Transaction
TransactionId-Sequence
Orders
OrderDetails
when I process a
daTransaction.update(dtTransaction)
daTransactionIdSequence.update(dtTransactionIdSequence)
|
by: =?Utf-8?B?UmljaA==?= |
last post by:
On a form - I have a datagridview which is docked to the entire form. The
datagridview allows users to Delete and/or Add Rows. On the Form_Load event
I Fill the datagridview source table with a sql DataAdapter (da)
da.SelectCommand.CommandText = "Select * from Servertbl1"
da.Fill(ds, "tbl1")
so far, so good. If I add a row to the datagridview I use the following
sqlDataAdapter code to update the server table - which works OK when...
|
by: AlexW |
last post by:
Hi
I have been scouring the web for some information regarding how to insert multiple rows at once using an SQL string. I am using an OLEDB dataadapter to communicate with an MS Access DB
The code below works:
myDataAdapter.InsertCommand = New OleDbCommand("INSERT INTO Inventory ( PartNum ) SELECT 'blah' AS PartNum FROM
myDataAdapter.Update(gbldataset, "Inventory")
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |