On Fri, 12 Mar 2004 08:41:56 +0100, Ivan Codarin <[EMAIL PROTECTED]> wrote:

Hi,
I've troubles with autoInc fields where the field is generated by Db.
Is there a way to read up the (autogenerated) ID field to pass it to other forms?
Now I'm creating interceptors to:


1) max_id =select max(id) from table
2) insert into table (id) values (max_id)
3) and pass this new value to the form with setFieldValue...

It sounds complicated to do this to all forms.
I'm using jdbforms 1.1.4pr2 13.12.2003.

What database are you using?


I talked this over with Henner before. He suggested using a sequence:

"In Oracle - for example - you can
use a sequence and write a view to get values from the sequence. Most
databases have something like sequence. To be indepent from the database i
define a view in the database to get id - using a sequence."

I can't use it myself (mysql doesn't have one) but it is a better idea than selecting the Max value since doing it with a max value means it's possible that if two users both insert at a simiar time, one of the users could lose thier data with a "duplicate key message". Of course if you have redisplay fields on error it is not so bad -- just a little confusing for the user.

Anyway, I am not exactly sure if using a sequence simplifies things completely but it seems a better way if you can do it that way.
--
Shawn


Happily using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/


------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ DbForms Mailing List

http://www.wap-force.net/dbforms

Reply via email to