custsoft
Programmer
- Aug 29, 2000
- 41
I have an access database that I am adding data to with a dataadapter and dataset with the following code:
Me.DstOwnerInfo1.Clear()
Me.oledb_adaptOwnerInfo.SelectCommand.Parameters ("ownerid").Value = 0
Me.oledb_adaptOwnerInfo.Fill(Me.DstOwnerInfo1)
OwnerBindingManager = Me.BindingContext(DstOwnerInfo1, "graveownerinfo")
OwnerBindingManager.AddNew()
OwnerBindingManager.EndCurrentEdit()
Me.oledb_adaptOwnerInfo.Update(DstOwnerInfo1)
The ownerid field is an autonumber field.
It adds the record correctly to the datagrid and database with the correct autonumber in the ownerid field.
But when I try to access the ownerid field in the dataset it always shows zero.
How do I get the added autonumber field?
Do I have to write code to requery the added row and get the ID etc
One more question, I am filling my dataset by querying on a zero ownerid, which should not exist. So I assume my dataset is empty and then I do the addnew. Is that a problem or do I have to go to the end of the full database?
Thanks for help in advance.
Me.DstOwnerInfo1.Clear()
Me.oledb_adaptOwnerInfo.SelectCommand.Parameters ("ownerid").Value = 0
Me.oledb_adaptOwnerInfo.Fill(Me.DstOwnerInfo1)
OwnerBindingManager = Me.BindingContext(DstOwnerInfo1, "graveownerinfo")
OwnerBindingManager.AddNew()
OwnerBindingManager.EndCurrentEdit()
Me.oledb_adaptOwnerInfo.Update(DstOwnerInfo1)
The ownerid field is an autonumber field.
It adds the record correctly to the datagrid and database with the correct autonumber in the ownerid field.
But when I try to access the ownerid field in the dataset it always shows zero.
How do I get the added autonumber field?
Do I have to write code to requery the added row and get the ID etc
One more question, I am filling my dataset by querying on a zero ownerid, which should not exist. So I assume my dataset is empty and then I do the addnew. Is that a problem or do I have to go to the end of the full database?
Thanks for help in advance.