我用delphi+Access 用如下程序段,希望可以修改表rwd中的ysc字段的值,ysc字段值为长整形,
q.Close;
q.SQL.Clear;
SQL:='select ysc from rwd where rwid='''+m+''' and gg='''+n+''' and dj='''+l+'''';
q.SQL.Add(sql) ;
q.open;
q.Edit;
q['ysc']:=xs ;//xs为整形变量
q.post;
系统提示错误,key column information is insufficient or incorrect.Too many rows were affected by update.
为什么有这种错误呢?
q.Close;
q.SQL.Clear;
SQL:='select ysc from rwd where rwid='''+m+''' and gg='''+n+''' and dj='''+l+'''';
q.SQL.Add(sql) ;
q.open;
q.Edit;
q['ysc']:=xs ;//xs为整形变量
q.post;
系统提示错误,key column information is insufficient or incorrect.Too many rows were affected by update.
为什么有这种错误呢?
解决方法:
1、'select ysc from rwd where rwid='''+m+''' and gg='''+n+''' and dj='''+l+'''';
把ysc替换成*,或者ysc+主键字段。
2、直接用update语句。
sql := 'update rwd set ysc='+IntToStr(xs)+' where rwid='''+m+''' and gg=......'