InsertCommand="INSERT INTO [TableOne] ([PersonID], [Name], [Image]) VALUES (@PersonID, @Name, @Image)
Performing this work, PersonID (Primary Key) 's wants. But I want to program make a Primary Key. What should I do?
Thank you.
Loading
InsertCommand="INSERT INTO [TableOne] ([PersonID], [Name], [Image]) VALUES (@PersonID, @Name, @Image)
Performing this work, PersonID (Primary Key) 's wants. But I want to program make a Primary Key. What should I do?
Thank you.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Feb 7, 2011, 5:43 AM
Please explain the thread with more information, so we can help you.
Micke BlomqvistPosted Feb 6, 2011, 1:48 PM
I don't know what db you use, but most of the allows you to add a identity column on a table, where you can set the startvalue and the seed(increment), and where the db it self keeps record of and giving each record a uniqe value. (int)
If you already have data in your table, you need save it to another one, and then add a identity column. Then you just re-insert the records using the SQL statement:
insert table_with_identity_column_table select PersonID, Name, Image from copy_table. You can use the above statement to insert new records, you don't supply any value for the identity column.
Each and every row get their uinqe identity and you can easilly return the output parameter @@Identity to get what the actual value back to you application.