Click to See Complete Forum and Search --> : A simple ADO.NET and table design question


dionchen1
February 13th, 2003, 11:59 AM
Hi, All:

I am writing my FIRST Windows Form Application in .NET to edit my MS Access database. In this Access DB, I have a table with two columns: EquipmentID and EquipmentDescription. Some other tables use the ID to refer the equipment. This application supports multiple users at the same time. That mean that it could be more than one user add new equipmment. I use in-memory DataSet to get user's input and then call Insert/Delete/Update methods. I am debating that whether I should use Access AutoNumber for the ID field, or I should just use DataReader to get the Max ID used, then Add 1 to create my new ID. The AutoNumber makes things simpler, but if I try to merge to DB later, I will have a lot of headaches. If I assign my own ID, I might have conflict with other users and fail the INSERT.

So what is the typical way to achieve this, I know a lot of people have done this, please give me some ideas. Thanks in advance.

Dion

gknierim
February 14th, 2003, 09:33 AM
Dion,

Typically I would use the Autonumber for what you are doing if your application is truly a multi-user app. But what concerns me is that you said if you merge the db together, it would cause headaches. Wouldn't you only have 1 database to work with since they are all going to be using the same database?

Or are you planning on having a separate database for each user and then merging all of them together? If that is the case, (which is bad design unless you have circumstances that warrant it), you would probably be better off writing a program to merge the databases together.

But...you could control what ID is for each equipment (that causes headaches too!) but if you are only going to be using 1 database, just let the Autonumber take care of.

HTH,
Greg

dionchen1
February 14th, 2003, 09:45 AM
Thanks for your help. I am going to use AutoNumber to achieve my goal.