开发者

SQL Paramaters in FoxPro 2.6 DOS

In FoxPro 2.6 for MS-DOS is there a way to use a variable in a SELECT command? For example, how can I write the foll开发者_StackOverflow社区owing query:

SELECT * FROM DBFILE WHERE Ord_no = temp_no

Given that temp_no is a previously defined variable. I tried using "&temp_no" but this does not appear to be the correct syntax.


Your code looks correct, and you shouldn't need to macro it via the "&". What may be failing is due to data types. If your table "dbfile", column "ord_no" is numeric and your variable "temp_no" is a character string, that would fail due to a data type mismatch... make sure they are the same data type... again, REGARDLESS of using the "&" macro.

MyVarOrd_No = 23

select * from DBFile where Ord_No = MyVarOrd_No

or if a string/charcter based column, just change

MyVarOrd_No = "23"
However you may need to pad with spaces/justify if its being picky.


The microsoft line on using variables in foxpro.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜