Click to See Complete Forum and Search --> : LastModified in ADO


Vlad Chapranov
May 26th, 1999, 08:55 AM
I need to have OrderID (Autonumber) of new record to create related record in a OrderDetail table. With DAO or Data Control it's very simple:
Data1.UpdateRecord
Data1.Recordset.Bookmark = Data1.Recordset.LastModified
Now you can reference to Data1.Recordset.Fields("OrderID") to get new OrderID.
How to perform this simple task with ADO DataControl or recordset?
To see the problem place regular DC and regular DBGrid, ADO DC and ADO Grid on the form. Connect both Data Controls to the same Table with Autonumber field and Grids to Data Controls respectively. Set AllowAddNew properties to True
and try to add new records in both grids. In regular Grid you'll see ID of new record just after you swiched to the previous record or performed
Data1.UpdateRecord
Data1.Recordset.Bookmark = Data1.Recordset.LastModified.
With ADO Grid you see "0" after you leave new record and if you come back to check the value of ID of new record, you'll find there Null.
I coudn't find anything similar to LastModified with ADO. I can only do
Adodc1.Recordset.Update
Adodc1.Refresh
Adodc1.Recordset.MoveLast
Sorry for long explanation.
Any help would be appreciated.
Thank you.
Vlad

Vlad Chapranov
May 27th, 1999, 08:55 AM
I've got fixed my problem.
First of all I used "PROVIDER=Microsoft.Jet.OLEDB.4.0" and .CursorLocation = adUseClient. When I changed it to "PROVIDER=Microsoft.Jet.OLEDB.3.51" and .CursorLocation = adUseServer it started to work the same way as with DAO.
I did it because I don't know the difference between them and I desided to use latest version. And if let's say I didn't have anything in a grid I would change Provider, but I did have.

Vlad