In your program you need to see what SQLEXEC() is returning. If it returns -1, use AERROR() to see what error it returned. That might help you track down the problem. There certainly shouldn't be a difference between running these commands from the command window or in a program. Are you sure you're not doing anything different?
>I type the following commands in the command window and they work well :-
>
>h=sqlconnect("aimaceff")
>x=sqlexec(h, "select * from machine where maccode='111'")
>?sqlresult.descrip
>
>But, when i type the same commands in my program, and run the program, the error message "Alias 'SQLRESULT' is not found."
>
>Can anyone tell me why?
>
>For your information, aimaceff is the data source name for ODBC connection and machine table consists of maccode and descrip columns.
>
>Thank U.