Murray Brown
asked on
VB.net add primary key identity column to datatable
HI
I am using the following VB.net code to add an identity column. How do I set it as the primary key too?
I am using the following VB.net code to add an identity column. How do I set it as the primary key too?
Dim dtNew As New DataTable()
'Add columns to DataTable.
'------------ ID Column -------------
dtNew.Columns.Add("ID")
'Set AutoIncrement True for the First Column.
dtNew.Columns("ID").AutoIncrement = True
'Set the Starting or Seed value.
dtNew.Columns("ID").AutoIncrementSeed = 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER