pk row record number?

ssfftt

Well-known member
Joined
Oct 27, 2005
Messages
163
Programming Experience
1-3
in MSSQL db, how can i keep the pk(e.g. userID) in a consistent sequence of number? sometimes it goes: 1, 2, 3, 4, 5, 100, 150, 235, 236. Is it possible to make it like: 1,2,3,4,5,6,7,8,9 ? plz help
 
ssfftt said:
well, it's not the answer to my question, is it?
No it's not, but I was letting you know, not gently, that I had moved your thread to the proper location. As for your issue, how are you creating the key values? Have you specified that the column is an IDENTITY column?
 
It's very poor explained question if i may ... how it's possible at all that UserID has random numbers? How you fill that field. Actually, what is the datatype of your field. Btw, notice that if youare deleting records from the table it is kinda normal that you will miss some numbers i.e. you have 1,2,3,4 and if you delete 2nd row you will have 1,3,4 even if this field has primary key and identity (what is strange here?)
Regards ;)
 
jmcilhinney, plz take it easy, i was just kidding, u know when u get a bit
headache you behave stupid :)

thx kulrom, I think you r right. but maybe not, because I dont do any add
or modification to the data in the datagrid, only remove selected record
and refresh the grid. I dont use dataset to hold the table for editing. instead,
I only find the pk when one record is selected and remove it from db by a
sqlcommand. the query is
VB.NET:
DELETE
FROM CYMUSER
WHERE UID = @UID
rest of my application all use the same thing, i only use dataset for displaying,
any add, modify or remove is performed by sqlcommand that is visually dorpped on the forms

ManicCW, set what field as unique and indentity? from db or my dataset in
the program?
 
ssfftt said:
jmcilhinney, plz take it easy, i was just kidding, u know when u get a bit
headache you behave stupid :)

thx kulrom, I think you r right. but maybe not, because I dont do any add
or modification to the data in the datagrid, only remove selected record
and refresh the grid. I dont use dataset to hold the table for editing. instead,
I only find the pk when one record is selected and remove it from db by a
sqlcommand. the query is
VB.NET:
DELETE
FROM CYMUSER
WHERE UID = @UID
rest of my application all use the same thing, i only use dataset for displaying,
any add, modify or remove is performed by sqlcommand that is visually dorpped on the forms

ManicCW, set what field as unique and indentity? from db or my dataset in
the program?

just try to say the same word or phrase like this again and you'll be banned from the forum. It was enough of giving a lessons to people like you who cannot understand the elementary principles of practicing good behavior avoiding to insult people who provide help here (without to be paid for that but rather only cuz they are willing to help).
Notice that this is not the way to provide a help for yourself ... at least i will not help you (now and also in the future).

Regards ;)
 
ok, enough, the red words was meant to apologize in a way that we both feel comfortable, if it didnt achieve it's purpose, i am sorry for my bad english expression. and more, i never insult ppl in my life, not even trying! I appreciate every one who helps me, if u lived near me, i'd even bring u a dozen beers for the help. I know how much $ a man with .NET knowledge is worth, and please dont waste ur time on helping me out just because you think i am dumb.

I feel very embarrassed now, plz feel free to kill ssfftt. If i wake up tomorrow morning and it's still a member of this forum, I will be the happiest guy in this forum and do only things listed below because you r the boss and i will do my best to make u happy:

1. whenever need help, post "problem details" ONLY
2. whenever someone tries to help, I post "thank you" ONLY
3. whenever I can help someone,post "solution" ONLY
Promise will not be broken, if it's time to leave, merry xmas and wish u all the best!
 
Back
Top