Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / September 2005



Tip: Looking for answers? Try searching our database.

How can I get a record count when using a Command Object?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Darrell Wesley - 27 Sep 2005 21:41 GMT
How can I find the number of records returned when using a command object?

With adoconn
   .ConnectionString = AS400CONN
   .Open
End With
With adoCD
   .CommandText = sql
   .CommandTimeout = 7000
   .CommandType = adCmdText

   .ActiveConnection = adoconn

End With
Set adoRS = adoCD.Execute

I can't build this using a  recordset because I need t set the timeout
property to something greated than 30 seconds (the default value).

Trying to do a adoRS.MoveLast produces the error :
Rowset does not support fetching backwards.

Any ideas?
Jan Hyde - 28 Sep 2005 09:13 GMT
"Darrell Wesley" <DarrellWesley@discussions.microsoft.com>'s
wild thoughts were released on Tue, 27 Sep 2005 13:41:04
-0700 bearing the following fruit:

>How can I find the number of records returned when using a command object?
>
[quoted text clipped - 14 lines]
>I can't build this using a  recordset because I need t set the timeout
>property to something greated than 30 seconds (the default value).

What makes you think you can't use a recordset?

J

>Trying to do a adoRS.MoveLast produces the error :
>Rowset does not support fetching backwards.

Jan Hyde (VB MVP)

Signature

How many mystery writers does it take to change a light bulb?
One, but he needs to give it a good twist.

(Sarah Stevenson)

[Abolish the TV Licence - http://www.tvlicensing.biz/]

Darrell Wesley - 28 Sep 2005 14:28 GMT
I've attemted to use the recordset object using :

adoRS.Properties("Command Time Out") = 7000

I find this has no affect - it still comes back with a message stating that
the calculated retrieval time exceeds 30 seconds.

So how do you set the time out parameter using a recordset and get it to work?

> "Darrell Wesley" <DarrellWesley@discussions.microsoft.com>'s
> wild thoughts were released on Tue, 27 Sep 2005 13:41:04
[quoted text clipped - 27 lines]
>
> Jan Hyde (VB MVP)
Jan Hyde - 28 Sep 2005 15:55 GMT
"Darrell Wesley" <DarrellWesley@discussions.microsoft.com>'s
wild thoughts were released on Wed, 28 Sep 2005 06:28:03
-0700 bearing the following fruit:

>I've attemted to use the recordset object using :
>
>adoRS.Properties("Command Time Out") = 7000

>I find this has no affect - it still comes back with a message stating that
>the calculated retrieval time exceeds 30 seconds.

>So how do you set the time out parameter using a recordset and get it to work?

Set the timeout on the connection not the recordset

btw, the RecordCount property depends on the type of cursor
your using and it also depends on the driver your using
supporting it (chances are it does, try a client side
cursor)

J

>> "Darrell Wesley" <DarrellWesley@discussions.microsoft.com>'s
>> wild thoughts were released on Tue, 27 Sep 2005 13:41:04
[quoted text clipped - 27 lines]
>>
>> Jan Hyde (VB MVP)

Jan Hyde (VB MVP)

Signature

'Every man has his price.  Mine is $3.95.'

[Abolish the TV Licence - http://www.tvlicensing.biz/]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.