guptateamdeveloper

Team Developer 2005.1 - Into Variable Always Empty


We are handling a legacy code which based on Team Developer 2005.1

There is a query like

  !!CB!! 70
Set sSqlCommand = '
            SELECT  name, value
            INTO    :sName, :sValue
            FROM    av_system_settings
            WHERE   name LIKE \'Company_\%\''
If NOT SqlPrepareAndExecute( hSqlMain, sSqlCommand )
    Return FALSE
Loop
    If SqlFetchNext( hSqlMain, nFetch )
    ...

Here the into variable :sName, :sValue are Strings but it always have empty value although the record has been looped correctly through SqlFetchNext

The into variable on other place are all fine. Just not working here one place.

Have run out of brain on this... Any idea? Guys :)


Solution

    1. For testing, you can use SqlImmediate(sSqlCommand ) instead of sqlprepareandexecute( ). If sName and sValue have value after executing sqlImmediate means sql working fine.
    2. Make sure SqlConnect() function returns true value. If it returns false then make sure database creditionals are correct.
    3. If the sValue variable need to hold Long data then please have a look on SqlSetLongBindDatatype ( ) function.

    4. Check the value of sql handle hsqlMain, if it have a postive value or one it means that handle connected properly. Otherwise if the handle value is null or zero, it means handle not connected.

    5. Try to use SqlFetchRow ( hsqlMain, nRow, nFetch ) and increment the value of nRow by 1 till function return false or the value of nFetch becomes FETCH_EOF.

      Set nRow = 0 While (TRUE) If not SqlFetchRow( hsqlMain, nRow, nFetch ) Break Set nRow = nRow + 1