Results 1 to 5 of 5

Thread: ADO Error [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    UK
    Posts
    147

    Question ADO Error [RESOLVED]

    When I run this script I get the error: Rowset does not support fetching backward.

    This error occurs when I try to use the Rst.MoveLast command but I was under the impression that I could do this if I had opened the record set as "Rst.CursorType = adOpenDynamic" obviously I am doing something wrong here can someone point me in the right direction please.


    VB Code:
    1. Dim CN As New ADODB.Connection
    2. Dim Cmd As New ADODB.Command
    3. Dim Rst As New ADODB.Recordset
    4. Dim DeviceCount As Integer
    5. Dim Count As Integer
    6.  
    7. 'Open DB Connection
    8. CN.Open DBPath
    9.  
    10. Set Rst = New ADODB.Recordset
    11. Rst.CursorType = adOpenDynamic
    12. Rst.Supports (adMovePrevious)
    13.  
    14.  
    15. 'Prepare the user-defined function statement and execute the command.
    16. Cmd.ActiveConnection = CN
    17. Cmd.CommandText = "SELECT DeviceName, DeviceType, CMACNum, Address, PLCID, NumEvents, StartRead, StopRead FROM SOEWFC_Definitions;"
    18. Set Rst = Cmd.Execute
    19.  
    20.    
    21. 'Check to see if there are any records in the table
    22. If Rst.EOF = False Then
    23.     'get number of rows in Backups table
    24.     Rst.MoveLast
    25.     DeviceCount = Rst.RecordCount
    26.     Rst.MoveFirst
    27. End If
    Last edited by mik706; Jun 13th, 2003 at 03:20 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width