Results 1 to 5 of 5

Thread: ADO Error [RESOLVED]

  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.

  2. #2
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918
    Try:
    Rst.CursorType = adOpenKeyset
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  3. #3

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

    Unhappy

    Tried that but i still get the same error.

  4. #4
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918
    OK. Try this:
    VB Code:
    1. Set Rst = New ADODB.Recordset
    2. Dim sql As String
    3. 'Prepare the user-defined function statement and execute the command.
    4. sql = "SELECT DeviceName, DeviceType, CMACNum, Address, PLCID, NumEvents, StartRead, StopRead FROM SOEWFC_Definitions;"
    5. Rst.Open sql, CN, adOpenKeyset
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  5. #5

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

    Talking

    Cheers pnish seams to be working OK now. Thanks for the help!!
    Mik706

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