firebird set generator

Posts   
 
    
jheinz
User
Posts: 4
Joined: 11-Jun-2006
# Posted on: 04-Jan-2007 12:29:34   

How can I do that:

Set generator myGen to 1;

With a stored procedure it is not ossible, because it doesn't support set ....

Can I execute the sl direct in any way?

Thanks a lot.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Jan-2007 17:02:09   

If you are trying to update all the records in a table, why don't you use the following:

SelfServicing: YourEntityCollection.UpdateMulti(...);

Adapter: adapter.UpdateEntitiesDirectly(...);

jheinz
User
Posts: 4
Joined: 11-Jun-2006
# Posted on: 04-Jan-2007 19:20:06   

I don't have an entity for the generator...

Without llbl I do it in this way:

FbConnection con = new FbConnection(adapter.ConnectionString); con.Open(); FbCommand cQuery = new FbCommand("set generator mygen to 1", con); cQuery.ExecuteNonQuery(); con.Close();

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 04-Jan-2007 19:30:41   

May I ask why you want to reset the sequence (generator) ?

You could obtain a connection, via DbUtils (selfservicing) or the DataAccessAdapter (via a derived class so you can access the CreateConnection method which you override ) and with that create a command and execute the statement.

Frans Bouma | Lead developer LLBLGen Pro
jheinz
User
Posts: 4
Joined: 11-Jun-2006
# Posted on: 04-Jan-2007 19:41:26   

I need the reset of the generator, because in my system I reset a number every year and in this way I create numbers like (I don't use these values for records!!!) like this:

06000<value from generator> 07000<value from generator>

Thank's for your answer. I will try it.