Hi, everybody,
i've dev a program that access to an mdb database and insert a new record with the command INSERT INTO but when i execute the db command with ExecuteNonQuery the program catch an exception that i did not understand.
I post the oledbcommand line and the fields of the access mdb.
objData = New CData(Application.StartupPath & "\Access.mdb")
objData.DatabaseCommand("INSERT INTO Invoice " & _
"(Number, Notes, Description, Quantity, " & _
"Cost, Import, ServicePayment, Tariff, SimgleUse, " & _
"BedAdd, Kids) VALUES (" & NF & ", '" & StringIntNotes & "', '" & _
StringIntDescription & "', '', '" & StringCost & "', '', '" & _
StringServicePayment & "', '" & StringTariff & "', '" & _
StringSimgleUse & "', '" & StringBedAdd & "', '" & StringKids & "')")
Where:
NF is INTEGER
StringIntNotes, StringIntDescription, StringCost, StringServicePayment, StringTariff, StringSimgleUse, StringBedAdd, StringKids are STRING
And the Access fields:
IDNumbInvoice: Primary Key - AutoIncrement Numeric Field
Number: Numeric
Notes: Text
Description: Text
Quantity: Text
Cost: Text
Import: Text
ServicePayment: Text
Tariff: Text
SimgleUse: Text
BedAdd: Text
Kids: Text
When i try to insert the new record the exception is "Syntax error in the expression INSERT INTO".
Thanks to all that try to solve my problem.
i've dev a program that access to an mdb database and insert a new record with the command INSERT INTO but when i execute the db command with ExecuteNonQuery the program catch an exception that i did not understand.
I post the oledbcommand line and the fields of the access mdb.
objData = New CData(Application.StartupPath & "\Access.mdb")
objData.DatabaseCommand("INSERT INTO Invoice " & _
"(Number, Notes, Description, Quantity, " & _
"Cost, Import, ServicePayment, Tariff, SimgleUse, " & _
"BedAdd, Kids) VALUES (" & NF & ", '" & StringIntNotes & "', '" & _
StringIntDescription & "', '', '" & StringCost & "', '', '" & _
StringServicePayment & "', '" & StringTariff & "', '" & _
StringSimgleUse & "', '" & StringBedAdd & "', '" & StringKids & "')")
Where:
NF is INTEGER
StringIntNotes, StringIntDescription, StringCost, StringServicePayment, StringTariff, StringSimgleUse, StringBedAdd, StringKids are STRING
And the Access fields:
IDNumbInvoice: Primary Key - AutoIncrement Numeric Field
Number: Numeric
Notes: Text
Description: Text
Quantity: Text
Cost: Text
Import: Text
ServicePayment: Text
Tariff: Text
SimgleUse: Text
BedAdd: Text
Kids: Text
When i try to insert the new record the exception is "Syntax error in the expression INSERT INTO".
Thanks to all that try to solve my problem.
Last edited: