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!

DataGridView and Autonumber
LeeroyB
Any ideas
Thanks!
Chris Langsenkamp
Hi
Check that the primary key Column AutoIncrement property is set to true.
Like
dgV.Columns["PK_ColumnName"].AutoIncrement = true;
Thanks
foobarX
Harry Hunt
Nick Gravelyn
Hi,
Are you having problems retrieving the last auto generated number try using the @@identity variable to retrive it.
SELECT @@IDENTITY AS ident
cheers,
Paul June A. Domag
Loki70
try the following code on form load event
dataset.tablename.fieldname.autoincrement=true.
Maurice Reeves
I have this problem as well.....bummer...did you get an answer
mteverest
if i got your problem
i m giving you over view try to this
Dim snoColumn As New DataColumn snoColumn.AutoIncrement = TruesnoColumn.ColumnName =
"sno" snoColumn.DataType = System.Type.GetType("System.Int32") snoColumn.AutoIncrementSeed =0snoColumn.AutoIncrementStep = 1
and add this column to your dataset.table(0)