TEXT TO cStr TEXTMERGE NOSHOW PRETEXT 4
SELECT * FROM 你表 <<cWhere>> into cursor 临时表
ENDTEXT
重点在这里 << >>,他会把 cWhere 的值自动转换,好像宏的效果,但比宏好用.如 cWhere = " where between(c值,c下限,c上限)"
经过<< >>转换后,上面的语句就变成
cStr = "SELECT * FROM 你表 where between(c值,c下限,c上限) into cursor 临时表"
如 cWhere = "",那么,查询就变成
cStr = "SELECT * FROM 你表 into cursor 临时表"
如 cWhere = "where between(a值,a下限,a上限) and between(c值,c下限,c上限)",那么,查询就变成
cStr = "SELECT * FROM 你表 where between(a值,a下限,a上限) and between(c值,c下限,c上限) into cursor 临时表"
MESSAGEBOX(cStr) && 观看查询语句,就是为了观察,动态语句是否是我们要的....
EXECSCRIPT(cStr) &&用他来执行查询 ,或者用 &cStr
<< >> 好像只能在 Text to ... EndText 中使用,
[此贴子已经被作者于2018-5-3 08:54编辑过]