Title: RE: SQL insert with preparedStatement
Daniel,
You don't add the column name that auto increments to your insert statements, it auto populates it. So, if you had 4 columns, and they were named "firstname, lastname, email, userid" and userid is your auto inc
Remove the column with the auto_increment from your parameterlist. the
database will do this for you.
Michael Balle
===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PR
Hello,
Thanks for the help! The following code works:
addSQL="INSERT INTO location (location, region,
addressLine1, addressLine2, addressLine3,
addressLine4, addressLine5, addressLine6,
addressLine7, addressLine8, addressLine9,
addressLine10, phoneNumber, faxNumber, manager1,
manager2, director
Or just insert a SQL Null into that field. It works the same way.
-Tim
-Original Message-
From: Daniel Jaffa [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 07, 2002 10:44 AM
To: [EMAIL PROTECTED]
Subject: Re: SQL insert with preparedStatement
This is more a database question and not
CTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 07, 2002 3:18 PM
Subject: SQL insert with preparedStatement
> Hello,
>
> I'm trying to Insert a new row into a MySQL database
> using a preparedStatement. However one of the fields
> in the database is an auto_inc
This is more a database question and not much of a jsp question
but here is the answer
addSQL="INSERT INTO location (put all the database column names, minus the
field that is auto_increment. Comma Delimented) VALUES (?, ?, ?, ?, ?, ?,?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
You should always n
Hello,
I'm trying to Insert a new row into a MySQL database
using a preparedStatement. However one of the fields
in the database is an auto_increment primary key. I
want to insert the all other fields into the database
and let the database enter the auto_increment primary
key. How do I do this