试试我的这个方法,肯定行。<br>首先用ADOConnection.execute执行命令,我试过了执行 select、Delete、存储过程都没问题。<br>var aaa:_Recordset;<br><br>aaa:= ADOConnection1.Execute('exec Add_Assigner ''000'', ''002''');<br>aaa:= ADOConnection1.Execute('select * From Table1');<br>aaa:= ADOConnection1.Execute('Delete From Table1 Where Code=''00''');<br>(上面语句一次选一个就行了,我是上述三种类似都试过了,都不会出错)<br> if Assigned(aaa) then <br> if aaa.Fields.Count > 0 then<br> ADODataSet1.Recordset := aaa;<br><br>原理:其实无论ADOQUERY还是ADOTABLE,最终都是执行adoconn.execute来执行语句或都存储过程的 <br>execute有两种方式,<br>一种是不返回结果,是PROCEDURE<br>procedure TADOConnection.Execute(const CommandText: WideString;<br> var RecordsAffected: Integer; const ExecuteOptions: TExecuteOptions = [eoExecuteNoRecords]);<br>var<br> VarRecsAffected: OleVariant;<br>begin<br> CheckActive;<br> ConnectionObject.Execute(CommandText, VarRecsAffected,<br> adCmdText+ExecuteOptionsToOrd(ExecuteOptions));<br> RecordsAffected := VarRecsAffected;<br>end;<br><br>一种是返回结果,是Function<br>function TADOConnection.Execute(const CommandText: WideString;<br> const CommandType: TCommandType = cmdText;<br> const ExecuteOptions: TExecuteOptions = []): _Recordset;<br>var<br> VarRecsAffected: OleVariant;<br>begin<br> CheckActive;<br> Result := ConnectionObject.Execute(CommandText, VarRecsAffected,<br> Integer(CommandTypeValues[CommandType])+ExecuteOptionsToOrd(ExecuteOptions));<br>end;<br><br>如果数据集控件是用execsql的,就调用procedure execute, 相反就调用 function execute, 交叉时就会出错楼上讲的提示。 <br><br>现在我们把这过程提前到先用function ADOCONN.EXECUTE()执行语句,然后自行判断有无结果返回,如有,才直接将结果赋值给ADODataSet显示,避免DELPHI默认的用ADOQuery.Open就调用funtion execute, 用EXECSQL就调用Procedure execute , 这样就可以解决楼主的问题了。