ODBC Multple Result Sets

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf ODBC Multple Result Sets

  • Creator
    Topic
  • #53182
    Todd Horst
    Participant

      Im wondering if anyone has done query using the data direct connect 5.2 that returns multiple data sets. And how you access the information in each set.

      Thanks,

      Todd

    Viewing 0 reply threads
    • Author
      Replies
      • #76848
        Todd Horst
        Participant

          Ok I’ve found the answer. Im using my own library for odbc, but you should be able to adapt it.

          Code:


          set catch_exec [odbc_exec “request”]
          if {[string match -nocase “*SQL_SUCCESS*” $catch_exec]==1} {
           odbc SQLBindCol $SH 2 SQL_VARCHAR server 10 pcbValue1
           set rVal [odbc SQLFetch $SH]
           while {[string match -nocase “*SQL_SUCCESS*” $rVal]==1}
           {                    
             echo $server
             set rVal [odbc SQLFetch $SH]
            }
          }
          echo
                     
          #Get next set
          set catch_exec [odbc SQLMoreResults $SH]
          if {[string match -nocase “*SQL_SUCCESS*” $catch_exec]==1}
          {
           odbc SQLBindCol $SH 2 SQL_VARCHAR tag 10 pcbValue1
           set rVal [odbc SQLFetch $SH]
           while {[string match -nocase “*SQL_SUCCESS*” $rVal]==1}  
           {                    
             echo $tag                        
             set rVal [odbc SQLFetch $SH]
           }
          }

          catch {odbc SQLFreeHandle SQL_HANDLE_STMT $SH}

      Viewing 0 reply threads
      • The forum ‘Cloverleaf’ is closed to new topics and replies.