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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Escape Sequences

Status
Not open for further replies.

WizardWayne

Programmer
Jan 15, 2001
3
US
I am running a stored procedure using the escape sequence syntax and all seems to be good. But once I introduce a date parameter I get the error -- 'Syntax error or Access Denied'. How do I use the escape sequence format on parameters.
 
Here is an example of what I am trying to do:

lcSQL = "get_Scheduler_code ( -1, 1002, 'WCH', '02/01/2001', '02/02/2001', 'test - wch - 02/01/01', 'RFS Level' )}"

lcSql = "{? = call " + lcsql + "}"

lnResult = SQLPREPARE(.mnHandle, lcSql)

The SQLPREPARE being used is the VFP 5.0 command.
For now the function was changed to accept string datatype inplace of date datatype - param 4 & 5. I would prefer to use, if possible, the escape sequence characters and have the function accept them as dates. Unless there is another alternative.

Any help is greatly appreciated.
Thanks in advance.
 
In your lcSQL = example, you included a trailing "}" which I assume is a typo.

date datatype - param 4 & 5. I would prefer to use, if possible, the escape sequence characters and have the function accept them as dates.

ODBC escape sequences use the "{ }" syntax, such as your CALL statement. I'm guessing you mean that you want to use bound parameters for your dates, something like:

[tt]MyDate1 = ctod("02/01/2001")
MyDate2 = ctod("02/02/2001")
lcSQL = "get_Scheduler_code ( -1, 1002, 'WCH',
?MyDate1, ?MyDate2,
'test - wch - 02/01/01', 'RFS Level' )"[/tt]

Make sure that you do NOT declare MyDate1/2 as Local; that seems to mess up when passing them to the ODBC driver.

Robert Bradley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top