Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sqlexec(<sqlcommand> INTO ARRAY) help

Status
Not open for further replies.

twigs1981

IS-IT--Management
May 29, 2002
52
US
The MSDN says that I can just have the results of the query go into an array however after it executes I have no way of getting the values from that array. I've tried display memory like <arrayname> which turns up null and I've tried using the the subscripts and get an error, however when I put the values into a Cursor I can do a select <cursorname> list and I see the values. So I know it isn't the SQL statement itself. So am I doing something wrong with the array, or is there some way I can get the column values for each tupple from the cursor? I'm using VFP 6.0 is that an issue for what I'm trying to do?

Thanks in advance
 
twigs1981 Are you running SQL to an external database (MS SQL) ?. Data from SQLEXEC() can not be directed to an array. If running on a foxpro database, the syntax

SELECT DISTINCT a.cust_id, a.company, b.amount ;
FROM customer a, payments b ;
WHERE a.cust_id = b.cust_id INTO ARRAY results

hope this helps Attitude is Everything
 
ooops yeah SQL server is MS SQL. So if I want to put the results of a query into varible(s) how would I go about that, or am I not able to? If I can't time to get the company to buy another language :p

...I'm Intern who has never used foxpro and if you don't count progress shell scripting I'm the only programmer here. I don't even have books on foxpro just the MSDN online, so my hands are kinda bound by ignorance...

Thanx again
 
what you could do is, with the sqlexec command send results to a cursor. then send cursor array with the command COPY TO ARRAY

SQLEXEC(nConnectionHandle, [cSQLCommand, [CursorName]])

select cursorname
copy to array arrayname

hope this helps Attitude is Everything
 
WORKS! Thanks much! Now the boss can relax and I can code!

appricate the help:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top