creating a primary key

seperate primary keys , different users , adodc connection Dubai, United Arab Emirates
  • 12 years ago
    i want to creat a primary key evertime a user raises a request...but there are two kinds of different lists of users so the this key should not overlap... on submittion the datas are stored in different databases so it cant be checked there... thus i've created a seperate database for the id alone... but from vb front end how can i goto the last record and add one for the next record... using ADODC connection and not DATA connection....and my record should have the first four digits as the year and the rest would be incremented... plz do let me know if u need any more information and if this is not clear enough!
  • 12 years ago
    Sounds like a weird use for a key, personally, i would be using GUID for something like that. Using a primary key to store parts of data that you can then reference is probably going to hurt the performance of your application. it would be far better to store the key as something unique and keep the year in a seperate column that can be searched. You never said what database type you were using, we use oracle and set up sequences and ask oracle to pick the next available number for us. i am not sure the SQL server equivalent is. Regards Si
  • 12 years ago
    try this i hope it will work to findout the last added recored SELECT @@IDENTITY OR SCOPE_IDENTITY()

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The generation of random numbers is too important to be left to chance.” - Robert R. Coveyou