Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 3rd, 2004, 10:47 AM
Authorized User
 
Join Date: Dec 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default Records returning slowly from SQL DB

I have some VB code that for some strange reason takes forever to return records from a SQL database. I'm calling a stored procedure (which supposedly is a fast way to get records from a SQL database). The delay is encountered as soon as the line that first checks for EOF is reached. It doesn't appear to matter how many record are actually found as a result of the call to the stored procedure.

What's strange is that I can copy the command that contains the stored procedure call and paste it in SQL Server Query Analyzer and the results are returned almost instantly.

Dim SSQL As String
Dim rc As ADODB.Recordset
Dim Fullname As String

    SSQL = "Exec [CurrentApproversByPC] '" & Me.CboPCs & "'"

    Set rc = New ADODB.Recordset

    With rc
        .ActiveConnection = cnOnlineTimecard
        .CursorLocation = adUseServer
        .Source = SSQL
        .Open
    End With

    Do While rc.EOF = False
 
Old November 11th, 2004, 03:14 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 142
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Quote:
quote:Originally posted by levinll
 I have some VB code that for some strange reason takes forever to return records from a SQL database. I'm calling a stored procedure (which supposedly is a fast way to get records from a SQL database). The delay is encountered as soon as the line that first checks for EOF is reached. It doesn't appear to matter how many record are actually found as a result of the call to the stored procedure.

What's strange is that I can copy the command that contains the stored procedure call and paste it in SQL Server Query Analyzer and the results are returned almost instantly.

Dim SSQL As String
Dim rc As ADODB.Recordset
Dim Fullname As String

    SSQL = "Exec [CurrentApproversByPC] '" & Me.CboPCs & "'"

    Set rc = New ADODB.Recordset

    With rc
        .ActiveConnection = cnOnlineTimecard
        .CursorLocation = adUseServer
        .Source = SSQL
        .Open
    End With

    Do While rc.EOF = False
What I'd try is setting the CursorLocation to adUseClient. It could well be that using a server cursor is causing the problem.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Query returning all records - why? Toiletbrush Infopath 1 November 21st, 2007 03:19 AM
help on returning records memewang Crystal Reports 0 April 14th, 2007 08:48 PM
Query returning No Records englandera Classic ASP Databases 2 November 22nd, 2004 10:54 AM
Problems With returning records through ADO marko_one Classic ASP Databases 5 September 30th, 2004 04:06 AM
Returning ONLY the latest records in a query kilkerr1 Access 3 November 3rd, 2003 01:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.