Closest method to a VBA recordset

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hi

Remember back in VBA, you could easily create a recordset, loop thru the
rows, and store the values of the columns to variables...

I am not even talking about writing back to the data...

It looks to me like I can use a forward only "datareader" which appears to
store a whole row of data into one long string, which I would then have to
use some parsing method in order to determine the value of a specific column
of data.

Or...

I could create a "dataset" which entails building all the required
structures (columns, rows, and tables) and then I still have to load and
loop thru it....

Is there some easier method to simply loop thru a block of data and return
the value of a column name I specifiy ?
 
It looks to me like I can use a forward only "datareader" which
appears to store a whole row of data into one long string, which I
would then have to use some parsing method in order to determine the
value of a specific column of data.

No, you can access the individual columns by going:

DataReader("ColumnName") OR DataReader(ColumnIndex)

I could create a "dataset" which entails building all the required
structures (columns, rows, and tables) and then I still have to load
and loop thru it....

Or just the datatable.
Is there some easier method to simply loop thru a block of data and
return the value of a column name I specifiy ?

Take a closer look at DataReader and DataSets ;-)
 
sorry life used to be much much simpler

now you've got to have a seperate connection per datareader; you can't
reuse a connection for really anything-- because ADO.net tries to help
out and automagically close any connection _EVER_ for no reason

MS screwed us all with .NET; it is best to stick with VBA until the
new version of Visual Fred comes out soon


I love Access Data Projects more than anything
 
Ahhh, I see...

DataReader("ColumnName") with a ".ToString" added does work fine

Thanks a Bunch !
 
Rob,

In my opinion is the DataTable almost 1:1 the recordset.

The first record is by instance
dt.rows(0)
The next record is
dt.rows(current + 1)
The last record is
dt.rows(rows.count -1)

Cor
 
Cor said:
Rob,

In my opinion is the DataTable almost 1:1 the recordset.

In my opinion a DataReader is much closer to a Recordset than a
DataTable is.

A DataTable is used for holding the data read from a DataReader, it
doesn't read anything from the database by itself. A Recordset doesn't
contain the data, but reads it from the database, just like a DataReader.

A DataReader is similar to a forward-only Recordset.
A DataTable is similar to a disconnected Recordset.
 
yeah... except you _STILL_ can't have multiple active DataReaders on
the same connection... even though Microsoft tried to CON us all into
buying SQL 2005-- so that we could use 'Multiple Active Result Sets'

I call BULLSHIT on microsoft, fix ADO.net it sucks balls compared to
ADO Classic
 
yeah... except you _STILL_ can't have multiple active DataReaders on
the same connection... even though Microsoft tried to CON us all into
buying SQL 2005-- so that we could use 'Multiple Active Result Sets'

I believe datareaders use a firehose mode to read data, thus only one
reader per connection.
I call BULLSHIT on microsoft, fix ADO.net it sucks balls compared to
ADO Classic

ADO Classic was definately easier to use ... but I don't have any major
complaints with ADO.NET.
 
uh

a) you can't leave a connection open
b) you can't have multiple recordsets open on the same connection

I mean.. WHAT A PIECE OF CRAP
I'd rather use ADO, the DAO then ADO.net
 
Back
Top