with datamodule1.Query_outplate do
    begin
        close;
        databasename:='case';
        sql.Clear;
        SQL.text:='update outplate set incomingquality = :incomingquality where factorycode = :factorycode and batchno=:batchno and model=:model and platesort=:platesort and platecolor=:platecolor';
        ParamByName('incomingquality').AsString:=trim(edit_quality.Text);
        ParamByName('factorycode').AsString:=str1;
        ParamByName('batchno').AsString:=str2;
        ParamByName('model').AsString:=str3;
        ParamByName('platesort').AsString:=str4;
        ParamByName('platecolor').AsString:=str5;
        prepare;
        execsql;
     end;

解决方案 »

  1.   

    对呀。。什么错误?prepare;  //这个有必要吗?
      

  2.   

    出错提示为ERROR creating cursor handle
      

  3.   

    找不出!可以在Execsql的地方用Ctrl+F7的快捷键然后用datamodule1.Query_outplate.sql.text取出当前的SQL命令到SQL的事件探察器里看一看就知道什么地方错了!
      

  4.   

    prepare;  //这个有必要吗?
    是加快操作
    哈哈
      

  5.   

    加上
    UnPrepare;
    顺便说明
    ParamByName().value;比ParamByName().asstring强
      

  6.   

    可能是你的SQL执行以后,更新数据库后,表中有了重复记录。
      

  7.   

    同意 blazingfire(烈焰)的说法,有重复的索引。
      

  8.   

    with datamodule1.Query_outplate do
        begin
            close;
            databasename:='case';
            sql.Clear;
            SQL.text:='update outplate set incomingquality
                = :incomingquality ';
            ParamByName('incomingquality').AsString:=trim 
                        (edit_quality.Text);
            execsql;
         end;
    语法没错!你先去掉条件语句(Where),看看能否找到错误地方!
      

  9.   

    哈哈
    ================================================================CSDN 论坛助手 Ver 1.0 B0402提供下载。 改进了很多,功能完备!★  浏览帖子速度极快![建议系统使用ie5.5以上]。 ★  多种帖子实现界面。 
    ★  保存帖子到本地[html格式]★  监视您关注帖子的回复更新。
    ★  可以直接发贴、回复帖子★  采用XML接口,可以一次性显示4页帖子,同时支持自定义每次显示帖子数量。可以浏览历史记录! 
    ★  支持在线检测程序升级情况,可及时获得程序更新的信息。★★ 签名  ●  
         可以在您的每个帖子的后面自动加上一个自己设计的签名哟。Http://www.ChinaOK.net/csdn/csdn.zip
    Http://www.ChinaOK.net/csdn/csdn.rar
    Http://www.ChinaOK.net/csdn/csdn.exe    [自解压]
      

  10.   

    我想在更改set incomingquality = :incomingquality 这个的同时,把筛选 出来的,以前表里面的那条记录加上行不行啊?
    就是说:我的表里有一条记录 
    A   B   C   D    E
    ds  df  j   ert  98我的E字段开始是数98,我用update更新后,能不能把98再加上我现在输入的所要更新的数值啊,比如我现在输入100,能不能使E字段变成198啊???
      

  11.   

    最好检查一下数据库的数据,可能有冗余的数据
    用Update就可以实现了
      

  12.   

    ERROR creating cursor handle?
    看不出错误在哪儿,建议用另一种方法去实现。
      

  13.   

    它的全部出错提示为:
    project case.exe raised exception class EnoResultSet with message
    'error creating cursor handle',process stoped,use step or run continue.怎么回事啊?
      

  14.   

    我改成下面这样,还是不行啊
    var
       str1,str2,str3,str4,str5:string;
    begin
       str1:=trim(edit_factorycode.Text);
       str2:=trim(edit_batchno.Text);
       str3:=trim(edit_model.Text);
       str4:=trim(combobox_sort.Text);
       str5:=trim(combobox_platecolor.Text);
       datamodule1.Query_outplate.Active:=true;
       if datamodule1.Query_outplate.Locate('factorycode;batchno;model;platesort;platecolor', VarArrayOf([''+str1+'',''+str2+'',''+str3+'',''+str4+'',''+str5+'']), [])=true then
       begin
            datamodule1.Query_outplate.Close;
            datamodule1.Query_outplate.DatabaseName:='case';
            datamodule1.Query_outplate.SQL.Clear;
            datamodule1.Query_outplate.SQL.text:='update outplate set incomingquality =incomingquality + :incomingquality where factorycode = :factorycode and batchno=:batchno and model=:model and platesort=:platesort and platecolor=:platecolor';
            datamodule1.Query_outplate.ParamByName('incomingquality').AsFloat:=strtofloat(trim(edit_quality.text));
            datamodule1.Query_outplate.ParamByName('factorycode').Value:=str1;
            datamodule1.Query_outplate.ParamByName('batchno').Value:=str2;
            datamodule1.Query_outplate.ParamByName('model').Value:=str3;
            datamodule1.Query_outplate.ParamByName('platesort').Value:=str4;
            datamodule1.Query_outplate.ParamByName('platecolor').Value:=str5;
            datamodule1.Query_outplate.prepare;
            datamodule1.Query_outplate.execsql;
       end else
       begin
            exit;
       end;