真是奇怪,我的ADODATASET的用法,总是出错
adodataset1.commandtext:='update user set userID='001' where userNm='ddd'';adodataset1.active:=true;
系统提示adodataset1不能返回值,
到底是怎么回事?

解决方案 »

  1.   

    应该像AdoQuery一样,如果不需要显示结果集的话应该用ExecSql()方法!!AdoDataSet也应该是这样的:)
      

  2.   

    建议使用ADOCommand,用ADODataSet不行
      

  3.   

    ADOCommand1.commandtext:='update user set userID=''001'' where userNm=''ddd''';
      

  4.   

    ADOCommand1.commandtext:='update user set userID='''001''' where userNm='''ddd''''
    哈,我也搞不清楚是几个分号了,
      

  5.   

    呵呵错了~
    ADOCommand1.commandtext:='update user set userID='''inttostr+(001)+''' where userNm=''ddd'''
      

  6.   

    to mrtxc(阿春)
    那adodataset1.commandtext跟adocommand1.commandtext有什么区别
      

  7.   

    adodataset1只能执行select之类返回结果集的语句,不能执行insert\update\delete之类无返回结果集的语句改为ADOQuery吧  ADOQuery1.Close;
      ADOQuery1.SQL.Text := 'update user set userID=''001'' where userNm=''ddd''';
      ADOQuery1.ExecSQL;
      

  8.   

    ADODataSet只能使用Select的SQL语句,不能支持其他的!!ADOQuery就可以但ADOCommand可以执行非Select的SQL语句,但不支持Select的SQL语句
      

  9.   

    请参考以下代码,测试过了,没有问题!
    adodataset1.Connection.Execute('update user set userID=''001'' where userNm=''ddd''');