This topic is locked

Primary Key

2/11/2008 2:33:27 PM
ASPRunnerPro General questions
M
MikeGinMN author

How would I generate a unqiue key for a table in asp runner. I would keep track of the number of additions in a table called count, each time someone added a person I want the count to go up one and store it back into table count. I then want to take that number and added WebAdd to the beginning of it. The entire length must be 16 characters. Example first record added would have key of WebAdd0000000001 the second would be WebAdd0000000002 and so on. Is this possible?
Any help would be appreciated - Thanks for your time and also to ASP Runner for a cool product

Sergey Kornilov admin 2/12/2008

I think you can use BeforeAdd event to get the highest existing number, increase it, and use it as a new record id.

G
goomba 3/11/2008

I think you can use BeforeAdd event to get the highest existing number, increase it, and use it as a new record id.


You could do this as well, it's easier me thinks:
SELECT count(COLUMN) FROM dbo.TableName.
This will give you the total number of records in a table (COLUMN can be any column)
<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=26877&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />