I'm tryin to do an sql query to fetch then dump the results to a dbf. i have done a simular task but can't seem to do a specific query. say an aurgument value was listed in the but no aurgument list was provided.
I have the form that i'm running the script from that contains the key cust to query by. Here is the code i'm trying to work with
Has some scratch on it from trying differt things
I have the form that i'm running the script from that contains the key cust to query by. Here is the code i'm trying to work with
Code:
'Date Created: 02-Apr-2010 04:37:06 PM 'Last Updated: 02-Apr-2010 04:37:06 PM 'Created By : mes 'Updated By : mes 'dim cust as c 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 dim args as sql::arguments DIM cust as sql::argument if a5_eval_valid_expression("=var->cust",local_variables()) then args.add("cust",convert_type(a5_eval_expression("=var->cust",local_variables()),"C")) args.add("cust",var->cust) end If 'Specify if you are using Portable SQL syntax, or not cn.PortableSQLEnabled = .t. dim sqlStatement as c sqlStatement = <<%txt% SELECT FIRST 1 * FROM enrollment WHERE custinfo_custid = :cust %txt% 'Execute a query on a SQL database '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\sqlenrollment.dbf") cn.close()