Hi Kai

 

For that table u can create a trigger before insert to set your next value
for generator and you don't need to pass any value for that field. After
inserting data (100 rows) generator will set value for each record
(especially if this field is primary key for table u need mechanism like
this).For updating data (for one record) you need to know his ID (unique) or
for multiple rows filter condition.

I have used 2 mechanism , depending on situation. Simple one is with
trigger.

Second one is putting one more column and write in that column unique data
(guid, timestamp, etc). This case I use where I don't have unique index and
are lot of inserting deleting from many connections.

 

Regards,

Paul

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Kai Bohli
Sent: Tuesday, May 08, 2007 2:47 PM
To: 'For users and developers of the Firebird .NET providers'
Subject: Re: [Firebird-net-provider] Issue with .net provider to work with a
Firebird generator

 

Hi Paul.

 

>Why you need to know generator value before insert?

I actually need the generator value after insert, but read in the firebird
faq that it was a lot safer to get the generator value before insert.
Anyway, I need this value cause the record inserted will be often updated
during an execution cycle. 

 

I've been thinking about another solution, but it's not exactly ideal:

1)      Insert a unique value in another field with the insert.

2)      Use a simple query like this: Select ID from tblThis where
myUniqueField = :MyUniqueValue;

3)      Use the id from this query to work with the record from there.

 

This will probably work, but there has to be a better and faster way.

 

Best wishes

 

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

Norway

 

 

 

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Mercea Paul
Sent: 8. mai 2007 13:13
To: 'For users and developers of the Firebird .NET providers'
Subject: Re: [Firebird-net-provider] Issue with .net provider to work with a
Firebird generator

 

Why you need to know generator value before insert?

 

Regards,

Paul

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Kai Bohli
Sent: Monday, May 07, 2007 9:17 PM
To: For users and developers of the Firebird .NET providers
Subject: [Firebird-net-provider] Issue with .net provider to work with a
Firebird generator

 

Hi all !

 

I have an existing table which I cannot change. That is, I cannot create a
on before insert trigger on it. I have to know the generator value before
insert so I have to run something like this:

 

SELECT gen_id(GEN_WEBOBJECTNR, 1) AS id FROM rdb$database

 

So far so good. Since I have all the dataaccess in a separate layer (DLL)
using the DDEX provider,  I would like to keep this in a tableadapter. But
the queryanalyser chokes on the $ sign in rdb$database. And if I include the
name in " like this "rdb$database" it will find the table but only 4 - 5
columns. The generators are not there. I could use a FBCommand through code
to get passed the queryanalyser, but then I met other problems. 

 

Any help are greatly appreciated.

 

Thanks in advance.

 

Best wishes

 

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 

Norway

 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to