Hi,
I've got an ID column in a dataTable that has auto-increment set to True. Yet for some reason when I add a new row that column maintains a value of DBNull! What's up with that?
Here is my code:
When Filling the table...
Code:
'First column, "PromoteID" is set as an identity in DB
da.FillSchema(dsTracking, SchemaType.Source)
da.Fill(dsTracking, "Tracking")
When adding a row later on...
Code:
'add a new record to Tracking table
Dim dr As DataRow = dsTracking.Tables("Tracking").NewRow
dr("EmployeeID") = EmployeeID.Text
dr("ChangeDate") = Today
dsTracking.Tables("Tracking").Rows.Add(dr)
When I debug, both dr("PromoteID") is DBNull and so is dsTracking.Tables("Tracking").Rows(...last row...)("PromoteID") after I add dr to the table.
One thing which might be significant is that I'm storing the dataset in the cache, and then retrieving it on postbacks.
Please help? My client is waiting none too patiently.
Aaron