VFP8.0与6.0的兼容问题。。。

Bosee 2003-06-20 05:28:13
我有一个VFP工程是用VFP6写的,编译运行一切正常。但是用VFP8.0编译运行就出现很长的一句错误:“加载文件时出错-记录号60。Formset1<或是它的一个成员>。 Parent: SQL:缺少 GROUP BY 子句或 GROUP BY 子句无效。代码(2005)”。有人遇到过这个问题吗?怎样解决呢?谢谢!
...全文
84 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
hnpyz 2003-06-24
  • 打赏
  • 举报
回复
在 语句前使用 : SET ENGINEBEHAVIOR 70
Bosee 2003-06-23
  • 打赏
  • 举报
回复
谢谢各位!
to hnpyz: 怎样设置兼容呢?我看过VFP8的“选项”都好像没有相关设置。最好能不更改代码就可以向下兼容。
tangmins 2003-06-23
  • 打赏
  • 举报
回复
不過容VF7.0是個好辦法
tangmins 2003-06-23
  • 打赏
  • 举报
回复
你的這個問題是因為SELECT 的字段不包含在GROUP 字句中引起的,現在VFP8SELECT語句基本上SQL SERVER相同
hnpyz 2003-06-21
  • 打赏
  • 举报
回复
8.0 的 SQL 数据引擎和以前版本有所改变。可以设置为兼容
cxmcxm 2003-06-20
  • 打赏
  • 举报
回复
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.

hansbarkley 2003-06-20
  • 打赏
  • 举报
回复
dyming兄果然厉害佩服佩服
dyming0410 2003-06-20
  • 打赏
  • 举报
回复
你在select前加SYS(3099,70)
这样Vfp8可以执行!
hansbarkley 2003-06-20
  • 打赏
  • 举报
回复
没碰到过
问题应该出在select语句里,如果select有两个条件则需要GROUP BY其中一个(好像是这样)你先检查一下有几个select,必要的话把代码放上来

2,749

社区成员

发帖
与我相关
我的任务
社区描述
VFP,是Microsoft公司推出的数据库开发软件,用它来开发数据库,既简单又方便。
社区管理员
  • VFP社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧