我有一个VFP工程是用VFP6写的,编译运行一切正常。但是用VFP8.0编译运行就出现很长的一句错误:“加载文件时出错-记录号60。Formset1<或是它的一个成员>。 Parent: SQL:缺少 GROUP BY 子句或 GROUP BY 子句无效。代码(2005)”。有人遇到过这个问题吗?怎样解决呢?谢谢!
...全文
849打赏收藏
VFP8.0与6.0的兼容问题。。。
我有一个VFP工程是用VFP6写的,编译运行一切正常。但是用VFP8.0编译运行就出现很长的一句错误:“加载文件时出错-记录号60。Formset1。 Parent: SQL:缺少 GROUP BY 子句或 GROUP BY 子句无效。代码(2005)”。有人遇到过这个问题吗?怎样解决呢?谢谢!
Enables SQL data engine compatibility with Visual FoxPro 7.0 or Visual FoxPro 8.0.
SET ENGINEBEHAVIOR 70 | 80
Parameters
70
Specifies that Visual FoxPro treats SQL SELECT commands as it did in versions prior to Visual FoxPro 8.0
80
Specifies that Visual FoxPro treats SQL SELECT commands as follows. (Default) SQL SELECT clause Behavior
DISTINCT You cannot use the DISTINCT clause with Memo or General fields. Instead, wrap a Memo field inside a function such as PADR( ) or ALLTRIM( ).
For more information, see PADL( ) | PADR( ) | PADC( ) Functions and ALLTRIM( ) Function.
UNION The UNION clause does not support Memo fields unless the ALL clause is included in the SQL SELECT statement.
GROUP BY The GROUP BY clause does not support Memo or General fields.
The GROUP BY clause must list every field in the SELECT list except for fields contained in an aggregate function, such as the COUNT( ) function. In addition, the GROUP BY clause must also list every field in a HAVING clause except for fields contained in an aggregate function.
For example, the following code raises an error because the field company is not listed in the GROUP BY clause.
SELECT company, country FROM Customer GROUP BY country
You can include an aggregate function in the SELECT list without having it in the GROUP BY clause.
For example, the following code uses the COUNT( ) function on the field company without having the field company in the GROUP BY clause.
SELECT COUNT(company), country FROM Customer GROUP BY country
HAVING A SQL SELECT statement can contain the HAVING clause without the GROUP BY clause as long as the SQL SELECT statement does not contain any aggregate functions.
For example, the following code filters query results by specifying the country field must equal "Sweden".
SELECT customerid FROM customers HAVING country="Sweden"
LIKE SQL SELECT statements do not automatically remove trailing spaces from values compared with the LIKE operation. In versions prior to Visual FoxPro 8.0, both values in the LIKE operation were trimmed from the right prior to evaluation.
For example, the following code assumes that you have a table named table1, and the table has three rows that contain values of "1 ", "12 ", and "123", respectively.
SELECT * FROM table1 WHERE column1 LIKE "1__"
Visual FoxPro version 7.0 and earlier returns one row with the value of "123". Visual FoxPro 8.0 returns three rows with the values, "1 ", "12 ", and "123".
If the beginning of the filter condition matches the pattern of the expression in the LIKE operation, and the rest of the filter condition contains trailing spaces, the LIKE operation ignores the trailing spaces and returns True (.T.). Trailing spaces in the pattern are not ignored.