How to get True DB Grid to retrieve "AutoNumber" column after Insert? 
Author Message
 How to get True DB Grid to retrieve "AutoNumber" column after Insert?

Using VB6 enterprise, ADO2 with Oracle 7.3 database, True DB Grid

Have setup an BeforeInsert & Sequence (does exactly the same as an AutoNumber field), so that when a
new record is added a unique number is generated for its ID field

From VB have a True DB grid control     with 2 columns, one to the ID field and the other to a
description field

When I save a record the unique id is generated OK but the grid does not automatically retrieve the
new ID value

I use this ID for other things and it has to be there, can I do this without having to requery the
entire recordset?

Any ideas!

Using Oracle Object for OLE all you had to do was to add ORADB_ORAMODE  to  OpenDatabase statement!

Thanks

Adrian Harrison



Thu, 10 May 2001 03:00:00 GMT  
 How to get True DB Grid to retrieve "AutoNumber" column after Insert?

Quote:

>Using VB6 enterprise, ADO2 with Oracle 7.3 database, True DB Grid

>When I save a record the unique id is generated OK but the grid does not
>automatically retrieve the new ID value

>Any ideas!

When I do something like that using Jet's autonumber datatype I always have
to read the key after updating the record, like this:

With rsNewData
    ' add new record
    .AddNew
    ' set each field's data for new record
    !Field1 = varFieldData1
    !Field2 = varFieldData2
    ...                                                    ' more fields...
    !Field_n = varFieldData_n
    ' save new record
    .Update
    ' Now READ the new autonumbered ID:
    nCurrentRecordID = !IdField
End With

' Now go on and do some stuff with the record...
...
...

Hope it helps

Saludos



Fri, 11 May 2001 03:00:00 GMT  
 How to get True DB Grid to retrieve "AutoNumber" column after Insert?
ms wrote an kb-article bout that - look for this!
the simplest way, to get an autoinc. id from a database (i just tried
it with access) is, to use serverside cursors - no code for retrieving
autoincrement numbers is needed.

hope it help

michael

Quote:

>Using VB6 enterprise, ADO2 with Oracle 7.3 database, True DB Grid

>Have setup an BeforeInsert & Sequence (does exactly the same as an AutoNumber field), so that when a
>new record is added a unique number is generated for its ID field

>From VB have a True DB grid control with 2 columns, one to the ID field and the other to a
>description field

>When I save a record the unique id is generated OK but the grid does not automatically retrieve the
>new ID value

>I use this ID for other things and it has to be there, can I do this without having to requery the
>entire recordset?

>Any ideas!

>Using Oracle Object for OLE all you had to do was to add ORADB_ORAMODE      to  OpenDatabase statement!

>Thanks

>Adrian Harrison



Sat, 12 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to get True DB Grid to retrieve "AutoNumber" column after Insert?

2. retrieve property "AUTOINCREMENT" of a column

3. Data Grid "How to Subtotal Columns"

4. txt.Span " ,;:.?!", True, True

5. "Find" in db grid

6. ** True Grid: How to Remove Add Record"

7. ** True Grid: How to Remove Add Record"

8. Autonumber "Trigger"

9. Accessing "autonumber" fields in ADO

10. Creating a field of type "autonumber"

11. Need help with "AutoNumber" index

12. Accessing "autonumber" fields in ADO

 

 
Powered by phpBB® Forum Software