Subject | RE: [firebird-support] Can't get Generator to work. |
---|---|
Author | Alan McDonald |
Post date | 2004-09-11T09:36Z |
> My understanding is, in order to create a unique number, a generator isforget delphi for the moment...
> created, link or attach that to a trigger and finally at the
> table end, that
> trigger is called in 'before insert'.
>
> When attempting to insert data using Marathon an error message is returned
> "Trip_ID" field must have a value. "Trip_ID" field is an integer (not
> null) and is suppose to have been populated with an incremented (unique)
> number. This is not occurring.
>
> Is my understanding correct or am I missing something. (I'm
> coming from a
> MS Access background)
>
> Any help would be appreciated.
>
>
> Steven Taylor
> Melbourne, Australia.
make sure your trigger is of the form which tests for null (see other posts)
then in Marathon issue the statement
INSERT INTO YOURTABLE (PK, OTHERFIELD) VALUES (NULL, OTHERVALUE);
(substitute your real statement)
You will have successfully inserted a triggered/generated value into a new
record.
if you first obtain a generated value from the grnerator and issue another
INSERT statement using this real value, then again, you will have
successfully inserted a record into your table.
If neither of these attempts work, then show us your trigger SQL..
You have not said how you tried inserting a record into your table, I would
have to guess that you just tried to use the downarrow in a datagrid of the
table data. Marathon may need your to commit this new empty row first before
you edit values... in anycase this method of adding records is not going to
be used by any client application you create.
Alan
Alan