I'm trying to pull sql data to a temp table that will be overwritten everytime the sql query is ran. I want to make a form to work the table which i'm thinking that i have to design it in the script , when i design the form within the script it opens unsaved and in design mode. Here is the sql code i'm starting with
i've tried to design the form and then run the script but it deletes the form when the table is overwritten
Code:
DIM cn as SQL::Connection dim flagResult as l flagResult = cn.open("::Name::*****.net") if flagResult = .f. then ui_msg_box("Error","Could not connect to database. Error reported was: " + crlf() + cn.CallResult.text) end end if 'Specify if you are using Portable SQL syntax, or not cn.PortableSQLEnabled = .t. dim sqlStatement as c sqlStatement = <<%sql% SELECT FIRST 1 custid, custfullname, fname, lname, address, city, state, zip, Dispo, findone, repid, called, cid, erollapdone, phone, notes_custid, callnote, payinfo, recentmtgamt, loanorigdate, recentlender, recentloantype, loantoval, age, creditrating FROM custinfo WHERE (phone IS NOT NULL ) AND (called IS NULL ) %sql% 'Execute the Query flagResult = cn.Execute(sqlStatement) if flagResult = .f. then ui_msg_box("Error",cn.CallResult.text) cn.close() end end if dim rs as sql::resultset rs = cn.ResultSet resultP = SQL_QueryImport(cn,sqlStatement,"C:\ahtdialer\tst.DBF") 'Execute a query on a SQL database 'DIM a connection variable 'Now, dump the contents of the ResultSet to a variable dim qpoint as c qpoint = rs.ToString() 'Now, close the connection cn.close()
Comment