>I'm trying to write some code which will Open a Table and Perform a SQL Statement On it using Paramters passed in, so nothing is Hardcoded/set at Design Time.
>
>My problem arrises when I try to use a SELECT statement, specifying the Fields I want to Select and the fields I wish to Compare in my WHERE Clause. If I pass a variable, (containing the field Name), it doesn't work, eg.
>
>SELECT m.MyField FROM m.MyTable INTO CURSOR curSQLCursor WHERE m.MyField LIKE 'Z%'
>
>In the above Statement, it treats m.MyField as a Literal, instead of substituting it for the Value held by the m.MyField Variable.
>
>Any help appreciated.
Try this
mysql="SELECT "+m.MyField+" FROM "+m.MyTable+" INTO CURSOR "+curSQLCursor+" WHERE "+m.MyField+" LIKE 'Z%'"
Should work
Jeff
It's Time to get a gun.
That's what I've been thinkin.
I think I can afford one, If I do a little less Drinkin.www.TrueGeeks.com