OK,
I am trying to insert a record into a table. One of the columns is an identity table - which means the dataBASE SHOULD AUTOGENERATE A VALUE FOR ME.
so the question is what value whould I set the identity column to when I try the insert If I try Nothing I get an error, if I leave it out completely I get an error....
Here is a sample of code...
dim dr as dataset.ContentRow
dim dt as dataset.Content
dr = dt.NewContentRow()
'so now set the value
dr.ID = Nothing <=====this is the IDentity column
dr.Name = "First"
dr.Addr = "Last"
etc etc
dt.rows.add(dr)
rc = Me.ContentTableAdapter.Update(dt)
Me.dataset.AcceptChanges()
Thanks,
Simon

Insert record into a table with an identity column
mikelyc
Hi,
Which version of visual studio.net 2005 are you suing
Thanks
Terry Amusa
Vimal@.Net
Simon
B.Lee
hi, simon
don't even refer to this column in your code and insert values to the rest of the cells except the identity,
dr = dt.NewContentRow()
'so now set the value
dr.Name = "First"
dr.Addr = "Last"
if that didn't work you might have a problem in your dataset, double click the dataset in your solution explorer, select the id column ,go to properties and see the autoincreament property and set it to true
hope this helps
cyberwalder
Hello Simon,,
Could you tell the database you're using Normally you don't have to do anything if you set the identity column to an auto increment.
Thanks
Terry Amusa
Lo, Kuei-yang