Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

VB Recordset problem

  • 07-03-2006 10:09AM
    #1
    Registered Users, Registered Users 2 Posts: 4,326 ✭✭✭


    I'm trying to loop through an Oracle table in VB and print the id number from that table but it's just printing the first one all the time while stuck in a infinite loop.
    I am well used to using recordsets in VB and have never had this type of problem before. However I have never printed anything to a text file in VB before so maybe I am doing something wrong.
    The line of code where it gets stuck is
    Print #1, "ID number of file: " & rs!doc_file_id
    

    Here is the full code:
    Option Explicit
    
    Dim rs As New Recordset
      
    Private Sub cmdStart_Click()
    Open "D:\appweb\Doc Exist Checker\log.txt" For Output As #1
    
        
        ' connect to the database
        OpenDBSpecUser "DEVT", "DOC", "DOC", "ORA"
        
        Dim strsql As String
                
        strsql = "select * from doc_file where doc_file_id between 122967 and 123000 and file_status = 0"
         
        
        rs.Open strsql, adoCnn
        
        
        Do Until rs.EOF
            ' loop through records
                       Print #1, "ID number of file: " & rs!doc_file_id
            
           
           
        Loop
        rs.Close
        Set rs = Nothing
        Close #1
        
        
    End Sub
    
    

    The is nothing wrong with the SQL statement either as it executes perfectly in Oracle.
    Any help would be great, thanks.


Comments

  • Registered Users, Registered Users 2 Posts: 4,326 ✭✭✭lukin


    Sorted it, I don't know as much about Recordsets as I thought;all it needed was the "MoveNext" command!
    I thought it would work without it.


Advertisement