ADO Record object 
Author Message
 ADO Record object

Currently designing a component that will loop through an  ado recordset and
at present I am having to pass the entire recordset between various
procedures/objects/components when all I really want is to pass the current
record.

When I look ADO in the object browser I find the record object which would
be the perfect solution as I could simply  pass the single record from the
recordset to the appropriate procedure/object/component but I can't seem to
find any info in MSDN etc on how to use the record object.

The other possible alternative is the fields collection but the record
object seems more elegant.

Can I set a record object to a specific record in a recordset?

Lowest of the Low



Tue, 26 Oct 2004 18:29:48 GMT  
 ADO Record object
LOTL

You likely will not be able to use the ADO Record object --

In order to use the Record object, the underlying OLEDB provider must
implement support for the ADO Record -- and many simply do not, especially
Microsoft Jet and Oracle.  Have a look at KB article Q248144.

If you need to pass the recordset to many procedures in you application -
then passing it as a Recordset By Reference may be the most efficient - you
are not actually passing the Recordset, rather a pointer to one and only one
instance of the Recordset object.

However, if you really do need a separate set of data that represents just
one row -- have a look at the GetRows method of the ADO Recordset.  The
method allows you to specify the start row, the count, and the fields --
GetRows returns an object of the variant data type containing a
multi-dimensioned array (M x N), where M is the number of fields and N is
the number of rows.  For your case, consider N=1.  This approach has a
potential  adverse performance hit because in addition to the delay of
fetching the rows, you also incur a delay while copying each field of each
row that is passed.  But it may allow you to decouple the application from
the specifics of the recordset implementation.

If you need to create a single row Recordset from the Recordset object
created by a many-row-returning SQL command, you can:
1. set a filter,
2. create a menory based IStream object,
3. save the recordset, then
4. open a new Recordset using the stream object as the recordset source.

I hope this helps.

best regards
roy fine



Quote:
> Currently designing a component that will loop through an  ado recordset
and
> at present I am having to pass the entire recordset between various
> procedures/objects/components when all I really want is to pass the
current
> record.

> When I look ADO in the object browser I find the record object which would
> be the perfect solution as I could simply  pass the single record from the
> recordset to the appropriate procedure/object/component but I can't seem
to
> find any info in MSDN etc on how to use the record object.

> The other possible alternative is the fields collection but the record
> object seems more elegant.

> Can I set a record object to a specific record in a recordset?

> Lowest of the Low



Wed, 27 Oct 2004 02:56:01 GMT  
 ADO Record object
Thanks Roy just the sort of info I needed to make the decision for the
design.

Lowest of the Low


Quote:
> LOTL

> You likely will not be able to use the ADO Record object --

> In order to use the Record object, the underlying OLEDB provider must
> implement support for the ADO Record -- and many simply do not, especially
> Microsoft Jet and Oracle.  Have a look at KB article Q248144.

> If you need to pass the recordset to many procedures in you application -
> then passing it as a Recordset By Reference may be the most efficient -
you
> are not actually passing the Recordset, rather a pointer to one and only
one
> instance of the Recordset object.

> However, if you really do need a separate set of data that represents just
> one row -- have a look at the GetRows method of the ADO Recordset.  The
> method allows you to specify the start row, the count, and the fields --
> GetRows returns an object of the variant data type containing a
> multi-dimensioned array (M x N), where M is the number of fields and N is
> the number of rows.  For your case, consider N=1.  This approach has a
> potential  adverse performance hit because in addition to the delay of
> fetching the rows, you also incur a delay while copying each field of each
> row that is passed.  But it may allow you to decouple the application from
> the specifics of the recordset implementation.

> If you need to create a single row Recordset from the Recordset object
> created by a many-row-returning SQL command, you can:
> 1. set a filter,
> 2. create a menory based IStream object,
> 3. save the recordset, then
> 4. open a new Recordset using the stream object as the recordset source.

> I hope this helps.

> best regards
> roy fine



> > Currently designing a component that will loop through an  ado recordset
> and
> > at present I am having to pass the entire recordset between various
> > procedures/objects/components when all I really want is to pass the
> current
> > record.

> > When I look ADO in the object browser I find the record object which
would
> > be the perfect solution as I could simply  pass the single record from
the
> > recordset to the appropriate procedure/object/component but I can't seem
> to
> > find any info in MSDN etc on how to use the record object.

> > The other possible alternative is the fields collection but the record
> > object seems more elegant.

> > Can I set a record object to a specific record in a recordset?

> > Lowest of the Low



Fri, 29 Oct 2004 15:36:39 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ADO Record object

2. ADO Record Object -Open

3. Record Count From ADO Command Object

4. How to delete records in ADO Object?

5. ASP - Saving html table records or ADO records to Excel or Work

6. VB6 ADO and Multiple Records/Single Records

7. Copy an ADO record to a new record?

8. ADO, Record Set Positioning - SQL - Browse Records

9. ADO and a counter in a record ->lock a record with mulituser

10. Open a Record object from a Recordset object

11. ADO Control OR ADO object?

12. ADO data control 6.0 and ADO data object 2.1 conflict

 

 
Powered by phpBB® Forum Software