Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MS Access trouble

0 views
Skip to first unread message

kbo...@accuris.ie

unread,
Oct 14, 1998, 3:00:00 AM10/14/98
to
Hi,
I am trying to store a record in Access using the following code.

PreparedStatement storeNewJob = con.prepareStatement("INSERT INTO job1
(field1,field2,field3,field4,field5) VALUES (?,?,?,?,?)");

storeNewJob.setInt(1, var1);
storeNewJob.setString(2, var2);
storeNewJob.setString(3, var3);
storeNewJob.setString(4, var4);
storeNewJob.setString(5, var5);

storeNewJob.executeUpdate();

but I am getting the following error:
Syntax Error in INSERT INTO statement.

The form of the table is
jobid ->AutoNumber
field1 ->Number
field2 ->Text
field3 ->Text
field4 ->Text
field5 ->Text

The only field I am not including is jobid which is AutoNumber so
I should not have to enter a value for it.

Can anyone help.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

ESPEYRAC

unread,
Oct 15, 1998, 3:00:00 AM10/15/98
to
have hou tried to put the values directly in SQL Statement first ?
I Think so
And i have the same probleme in an SQL INSER INTO statement with date/time
field ,in
MS Visual Basic 4.0

ESPEYRAC

unread,
Oct 15, 1998, 3:00:00 AM10/15/98
to
Don't you try this ?
storeNewJob.executeUpdate("INSERT INTO job1
(field1,field2,field3,field4,field5) VALUES (?,?,?,?,?)");


kbo...@accuris.ie

unread,
Oct 16, 1998, 3:00:00 AM10/16/98
to
I tried that and it did not work. One of my columns was called date
so I changed the name and it works OK now.

In article <19981015175409...@ng40.aol.com>,

-----------== Posted via Deja News, The Discussion Network ==----------

b

unread,
Oct 31, 1998, 3:00:00 AM10/31/98
to
In the future, if you want to you a field name that shares a keyword such
as "date", simple query it like such " SELECT `date` FROM [Table]; "
instead of " SELECT date FROM [Table] "

Joshua Baker
bak...@digitalaquarius.com

0 new messages