ADO Disconnected Recordset Index 
Author Message
 ADO Disconnected Recordset Index

I am writing a class that reads data from an Excel
spreadsheet. When the class initializes, it creates a
disconnected recordset to add the data to. The first
field of the recordset needs to act as a primary key so
that no references are duplicated, how do I set a unique
index in a disconnected recordset?

The codes that creates the recordset is:

*****************************************************
Set m_rsAdresses = New ADODB.Recordset

With m_rsAdresses
    .Fields.Append "UPRN", adVarChar, 12, adFldRowID
    .Fields.Append "Address", adVarChar, 50
    .Fields.Append "Postcode", adVarChar, 8
    .CursorType = adOpenStatic
    .LockType = adLockBatchOptimistic
    .Open
End With
*****************************************************

This will let me read in 2 records with the same UPRN,
the UPRN field needs to be unique.

An index is maintained at the database level. I'm not aware of any way to do this with a
disconnected Recordset. You will need search the Recordset in order to determine whether an item in
a particular field, or set of fields, already exists.


Microsoft MVP (Visual Basic)



Sat, 07 May 2005 00:25:46 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ADO fails to release Recordset cursor after opening disconnected Recordset

2. Disconnected Recordsets in ADO.NET?

3. sub records in ADO disconnected recordset

4. Disconnected ADO Recordset-Updating

5. Copying Disconnected ADO Recordset

6. connecting a disconnected ADO recordset

7. Run SQL Statement Against Disconnected ADO Recordset

8. Disconnected ADO Recordset w/ a Stored Procedure?

9. ADO Disconnected Recordset type mismatch error

10. ASP and ADO disconnected recordsets

11. Problems with Disconnected ADO Recordset in ASP

12. Creating a disconnected copy of an ADO Recordset

 

 
Powered by phpBB® Forum Software