I have a datatable from database on the basis of some query.
I want that datatable to have a primary key for an existing column.
How can I do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming the name of the column in your data table you want to be the primary key is called
pk_column, you could do this (assumedtis yourDataTable):If your primary key is made up of multiple columns, you can add them to the array, like so:
So if you were making student_id your primary key, you could do this: