Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB Recordset problem

Options
  • 07-03-2006 10:09am
    #1
    Registered Users Posts: 4,037 ✭✭✭


    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 Posts: 4,037 ✭✭✭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