I have had the same problem. Usually I'll make a stored procedure for
inserts that takes as parameters the values you wish to store, inserts
the new row and returns the new ID.
This is for Postgres, but you can adapt it to your DB:
CREATE FUNCTION new_row(INTEGER, VARCHAR, VARCHAR, DATE, DATE, DATE)
RETURNS INTEGER AS '
DECLARE
in_some_number ALIAS FOR $1;
in_firstname ALIAS FOR $2;
in_lastname ALIAS FOR $3;
in_online_date ALIAS FOR $4;
in_retire_date ALIAS FOR $5;
in_data_date ALIAS FOR $6;
newId INTEGER NOT NULL DEFAULT 0;
BEGIN
SELECT INTO newId nextVal(\'row_id_seq\');
RAISE NOTICE ''ID %'',newId;
INSERT INTO my_table
(row_id, some_number, firstname, lastname, online_date,
retire_date, data_date)
VALUES (newId, in_some_number, in_firstname, in_lastname,
in_online_date, in_retire_date, in_data_date);
RETURN newId;
END;
' LANGUAGE 'plpgsql';
--- Phillip Morelock <[EMAIL PROTECTED]> wrote:
> AFAIK you can't do this.
>
> with HTTP file uploads you have to store the data immediately or it
> is lost.
> You have to store the file part to a temp file, then do all your
> work, then
> come back and move the file and give it your new name, or delete it
> if your
> transaction didn't go through.
>
>
>
>
> On 5/3/02 1:01 AM, "# Lalit Nagpal #" <[EMAIL PROTECTED]> wrote:
>
> >
> > sorry out of topic
> >
> > i am uploading files along with some form data, strategy is i store
> form data
> > first the primary key is auto_incremented and then i name the
> uploaded files
> > with the primary key so that i can recognize which uploaded file
> belongs to
> > who. now when i store the record in mysql i get back a resultset
> which
> > contains no value (returned by statement.executeQuery(insert ...)).
> How to get
> > the primary key which is auto generated (incremented by mysql)
> after inserting
> > a record (primary key of the inserted record).
> >
> > suggestions welcome and thanx in advance
> >
> >
> >
> >
> > # Lalit Nagpal #
> >
> >
> > ---------------------------------
> > Do You Yahoo!?
> > Yahoo! Health - your guide to health and wellness
>
>
> --
> To unsubscribe: <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>