Using SQL Pass Through to Access my Remote Data Source

Here's the source code which I copy from QUE Book('The One Source for Comprehensive Solutions' by Menachem Bazian)

//*using SQL PASS THROUGH TO ACCESS DATA SOURCE *//
LOCAL lnHandle
lnHandle = SQLConnect("My Remote text")
IF lnHandle > -1
   SQLExec(lnHandle, "SELECT customers.* FROM customers","Results")
   SELECT Results
   BROWS
   SQLDisconnect(lnHandle)
ENDIF

I try that sample, and also checking my ODBC connection just to be sure.  Then the first error is this,  NO CURSOR CREATED,... nothing happens, it did not shows the content of the customers file, then the second is..."INVALID CALL WHILE EXECUTING A SQLEXEC SEQUENCE".

Is there any other FREE source code using SQL PASS THROUGH that really works

thanks for any help



Answer this question

Using SQL Pass Through to Access my Remote Data Source

  • Rory Wilson

    Vasim & CetinBasoz,

    Thank you very much for the help, now i got it right! it works fine now.

    Have a nice day and more power

  • Ernest D Cook

    Try:

    LOCAL lnHandle
    lnHandle = SQLConnect("My Remote text")

    * You can also try this:-
    * lnHandle = sqlstringconnect("Your DNS-Less Connection String")


    IF lnHandle > -1
       SQLExec(lnHandle, "SELECT customers.* FROM customers","Results")
       SELECT Results
       BROWS
       SQLDisconnect(lnHandle)
    ELSE
       = AERROR(aSQLErrorArray)  && Data from most recent error
       FOR n = 1 TO 7      
           aSQLErrorArray(1,n)
       ENDFOR
       
       IF ALEN(aSQLErrorArray,1) = 2 && ODBC error
          
           "ODBC ERROR"
          FOR n = 1 TO 7      
                 aSQLErrorArray(2,n)
          ENDFOR
       ENDIF
    ENDIF

    Now you can see the error messages, hope this helps.


  • KathTam_MS

    Read 2nd error message you got. Probably you set it to asynschrounous and select ... from customers is still executing.
    Try with:

    SQLSETPROP(myHandle, 'asynchronous', .F.)


  • Perry G

    Ok thanks for the error message, but how about showing that result, it did not shows-up although you are connected why and when it reach the brows command it gives an error 'TABLE NOT FOUND"

  • Using SQL Pass Through to Access my Remote Data Source