Re: how to get recordcount from command.execute -- select * from t
- From: "Mark J. McGinty" <mmcginty@xxxxxxxxxxxxxxx>
- Date: Mon, 27 Feb 2006 00:45:45 -0800
"Rich" <Rich@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:994C986B-26FE-4218-86DB-BA1F94E81949@xxxxxxxxxxxxxxxx
Thank you very much for your reply. Very helpful. What I was missing was
cmd.ActiveConnection.CursorLocation = adUseClient.
Now I can get my RecordCount
There are times when a client cursor will be impractical, such as when the
query returns a large number of rows.
In those cases you'll need to make second query to get the row count:
SELECT COUNT(*) AS RecCount FROM Tbl1, which will return one row with one
field (containg the count, needless to say.)
-Mark
"Orimslala" wrote:
The ADO RecordCount property indicatest the number of records in a
recordset object, so that is the way to do it.
DIM intNumber as INTEGER
Dim RS As ADODB.Recordset
'
'
intNumber = RS.RecordCount
Also, make sure the CursorLocation property of your connection object
is set to adUseClient
Orims
Rich wrote:
Hello,
Dim cmd As New ADODB.Command, RS As New ADODB.Recordset
cmd.ActiveConnection = "...."
cmd.CommandType = adCmdText
cmd.CommandText = "Select * From tbl1"
Set RS = cmd.Execute
Is there a way to return the count of records returned? RS.RecordCount
returns a "-1". I tried RS.MoveLast and got an error "no forward
fetching".
I also tried with connection object - same thing
Set RS = conn.Excecute(strSql, recCount)
Any suggestions appreciated.
Thanks,
Rich
.
- References:
- Prev by Date: RE: Strongly Typed Dataset vs. Null Columns
- Next by Date: ADO to SQL types
- Previous by thread: Re: how to get recordcount from command.execute -- select * from tbl1?
- Next by thread: RE: Strongly Typed Dataset vs. Null Columns
- Index(es):
Relevant Pages
|
|