How do you autoincrement primary key in Visual Studio Databse

i have a Database in Visual Studios with the following fields

OrderID char(10)
CustomerID char(10)
CardID char(10)

when a new record is put in i want the orderID to increment by itself information entered into database is added
on a webpage using textboxes. the language i am using is C#

Who is Participating?
GiftsonDJohnConnect With a Mentor Commented:

Make the OrderID column as Identity. It will have the option for auto incrementing the value. You can get the identity option from orderid column properties.
Chris LuttrellConnect With a Mentor Senior Database ArchitectCommented:
I assume your database is SQL 2008, you can set a filed in the table to be an IDENTITY field but its type must be of data type int, bigint, smallint, tinyint, or decimal or numeric with a scale of 0, and constrained to be nonnullable.  If you can change OrderID to be an Int you can use that.
MUDDY_123Author Commented:
Thank You
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.