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

FoxPro 2.6 doesn't support SQL in stand-alone exe. 1

Status
Not open for further replies.

dsawford

Programmer
Jul 20, 1999
6
0
0
US
Is it possible to use SQL statements in an exe? We needed to modify a database, and it's cdx index. We used FoxPro 2.6 since the legacy programs that create and maintain the database are written in 2.6 and require the cdx index.
A couple of SQL statements using SELECT DISTINCT commands did the job very nicely, when running from within the deveolopment environment, but when we run the exe, we get a message indicating that FoxPro doesn't support this in an exe.
Is there a way to work around this? It will complicate the program a great deal to rewrite the program without using SQL.
Thanks for any suggestions.
 
I forgot to mention that this is the DOS FoxPro 2.6.
 
Use Macro Substitution to run your SQL statement.
Build up the SQL select string into a Memory Variable and then put the &(Macro Substitution character) in front of the Memory Variable such that you interpret the changes at Run Time.

i.e

SelectStr = "Select "
FieldList = "NAME, ADDRESS, POSTCODE"
DbName = " from mydata"
wherestr = " where name > "dav"
orderstr = " order by address"

Now put it all together:-

MySQLStr = SelectStr+FieldList+DbName+wherestr+orderstr

To run the SQL command:-
&MySQLStr

Obviously you can build up MySQLSTR to have joins to other tables, customise field entries, titlename, changed orders, even put in Run Time Variables with a little imagination - (something SQL can't do !!) ==>

I leave this to you to have fun with!!

HTH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top