在delphi中,我用update来更新记录,其语句为:
sql.add('update Tuser set 秘密='''+edit1.text+''' where 密码=''11''');
其中tuser 是表名,我一运行时就出现error creating cursor handle这种错误,怎么改?

解决方案 »

  1.   

    这个错误好像和你的鼠标形状有关系阿,你用了cursor变形吗?
      

  2.   

    没有语法错误:
    用AdoQuery例子
    with QdoQuery1 do
    begin
      close;
      sql.clear;
      aql.text:='update Tuser set 秘密='''+edit1.text+''' where 密码=''11''';
      sqlexec;
    end;
      

  3.   

    没有语法错误:
    用AdoQuery例子
    with AdoQuery1 do
    begin
      close;
      sql.clear;
      aql.text:='update Tuser set 秘密='''+edit1.text+''' where 密码=''11''';
      execsql;
    end;
      

  4.   

    我没有用cursor啊。
    aql.text:='update Tuser set 秘密='''+edit1.text+''' where 密码=''11''';中的aql.text是什么意思啊?我看不懂
      

  5.   

    CursorLocation := clUseClient;
    CursorType := ctKeyset;有没有动态改变鼠标形状
      

  6.   

    没有啊,cursor的所有东西我都没改过啊,我急啊,求求各位,如果你们帮了我,我会很感激你们的,我也会为你们祈祷,祝福你们!!!
      

  7.   

    楼主是用open方法或设定active属性为true来运行SQL语句的吧。SQL中update和insert不返回结果dataset,所以要用ExceSQL方法来运行。
      

  8.   

    jetjack非常感谢你,你说的非常对,我怎么就没想到呢。谢谢你!!!我还有个问题,如果我要判断“密码”是否等于一个值,在
    with query do
    begin
      close;
      sql.clear;
      sql.add('update Tuser set 秘密='''+edit1.text+''' where 密码=''11''');
      execsql;
    end;
    这里面怎么判断呢?
      

  9.   

    在添加SQL之前,对密码进行判断再加入
    if 密码=一个值then
      sql.add('update Tuser set 秘密='''+edit1.text+''' where 密码=''一个值 ''');
    else 
      sql.add('update Tuser set 秘密='''+edit1.text+''' where 密码=''相应值''');
      

  10.   

    不是拉,我是在update 之后再判断,不是之前。