DataGridView and Autonumber
Hey guys,
I noticed that each time I insert a record in the DataGridView, I must fill out the ID column (primary key) as well. I have it set to autonumber in Access, and when I fill in data some other way it works, however in the DGView I have to fill it out manually or it will throw an Exception. Any Ideas?
Thanks!
No, I'm using access. I'm not trying to retrieve anything. When I insert a row right into a DataGridView (it allows insertion, updating and deletion) I have to manually type the next ID (primary key) in instead of the autonumber doing it for me. I'm not submitting a form, I'm actually inserting the values straight into the datagrid.
Any ideas?
Thanks!
if i got your problem
i m giving you over view try to this
Dim snoColumn As New DataColumn snoColumn.AutoIncrement = True snoColumn.ColumnName =
"sno" snoColumn.DataType = System.Type.GetType("System.Int32") snoColumn.AutoIncrementSeed =0 snoColumn.AutoIncrementStep = 1
and add this column to your dataset.table(0)