Delphi ADOQuery错误:ADOQuery1:commandtext does not return a result set

Delphi ADOQuery错误:ADOQuery1:commandtext does not return a result set

错误描述:commandtext 不能返回结果集

原因分析:SQL 执行Delete、insert、update  无返回值,故不能用open

sSQL:='exec 存储过程';    
with ADOQuery do begin
   Close;
   SQL.Clear; 
   SQL.Add(sSQL);
  //open;   //执行insert 和 update 无返回值,故不能用open,否则报错:commandtext does not return a result set
    ExecSQL;
end;

解决方法:用 ExecSQL; 后再获取参数返回值

  

  

创建时间:2020.10.12  更新时间:

原文地址:https://www.cnblogs.com/guorongtao/p/13803410.html