Home > Archive > Visual Basic > April 2006 > Recordset Question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Recordset Question
|
|
|
| Hi,
I do alot of querying a sql sb and load the results into a recordset. This
data is only read-olny so I will never update the db. Right now I use a
disconnected recordset because I thought it be more efficient. Is this a
good practice?
Thanks
| |
|
| Best thing to do is open the Recordset as a firehose recordset (Forward
Only, Read Only) and either:
1) Use the recordset object to display or work with the records
-or-
2) Use the GetRows method of the recordset to push the records into an array
and then work with that, then you can release the recordset.
GetRows:
http://www.devguru.com/Technologies...et_getrows.html
A lot depends on other things that may be occurring when you have this
recordset populated.
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--
"matt" <matt@no.com> wrote in message
news:%23hmtb6jaGHA.4340@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I do alot of querying a sql sb and load the results into a recordset.
> This data is only read-olny so I will never update the db. Right now I
> use a disconnected recordset because I thought it be more efficient. Is
> this a good practice?
>
> Thanks
>
| |
|
|
"matt" <matt@no.com> wrote in message
news:%23hmtb6jaGHA.4340@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> I do alot of querying a sql sb and load the results into a recordset.
> This data is only read-olny so I will never update the db. Right now I
> use a disconnected recordset because I thought it be more efficient. Is
> this a good practice?
Well, it's not a bad practice. It depends on your needs. In my own
experience, I've only ever actually NEEDED a disconnected recordset on very
rare occasions. This is because I generally don't keep the recordset around
as a means of "temporary data storage". For example, you might be putting
all the data from the recordset into a ListView (or perhaps a grid control).
Once you've done that, you really don't need the recordset object anymore.
Probably, what would be better for you is a forward-only, read-only cursor.
This is the most efficient kind of cursor to use for a recordset. You might
specify this kind of cursor as such:
oRS.Open sSQL, m_oConn, adOpenForwardOnly, adLockReadOnly, adCmdText
(the above uses ADO and m_oConn is an object variable for an
ADODB.Connection object)
--
Mike
Microsoft MVP Visual Basic
|
|
|
|
|