Adding multiple nodes - ID field = 0

Posts   
 
    
ianvink
User
Posts: 394
Joined: 15-Dec-2006
# Posted on: 31-May-2007 14:56:28   

Newest version C#, Self Servicing, 2 Classes

What is the best practise for this situation.

I have a grid bound to an Entity Collection. The Entity's ID field in the DB is a standard auto-numbering int.

In code I add multiple entities, but the Grid complains that there are multiple entities with ID =0.

If I save to the DB after each add and refresh it's fine of course as the ID field picks up the value that SCOPE_IDENTITY() give it.

Is there a way to get a 'fake' id that auto updates in memory, then hen saves, uses the DB's auto-numbering?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 31-May-2007 15:22:49   

I have a grid bound to an Entity Collection. The Entity's ID field in the DB is a standard auto-numbering int.

In code I add multiple entities, but the Grid complains that there are multiple entities with ID =0.

I wonder why is that, it's not the grid's business as far as I know.

Would you please elaborate more? - Is this a web app or a win app? - Is this a .NET 2.0 or .NET 1.1? - Are you using any special/3rd party grids? - Would you please post the Grid's complain text and any stack trace if available?

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39914
Joined: 17-Aug-2003
# Posted on: 01-Jun-2007 11:18:14   

there's no 'fake' id feature build in. Could you check if you've set the grid's column to be unique or something? (as it's autonumber, that setting won't matter anyway)

Frans Bouma | Lead developer LLBLGen Pro