能,在ADOCONNECTION的 OnConnExecuteComplet事件里可以实现,下面代码得到更新语句中的表名。<br>procedure TConnExcute.OnConnExecuteComplet(Connection: TADOConnection;<br> RecordsAffected: Integer; const Error: Error;<br> var EventStatus: TEventStatus; const Command: _Command;<br> const Recordset: _Recordset);<br>var SqlTxt,TableName:String;<br> i:Integer;<br>begin<br> SqlTxt:=Command.CommandText;<br> TableName:='';<br> if StrIsBegin('Update',SqlTxt) or<br> StrIsBegin('Insert',SqlTxt) or<br> StrIsBegin('Delete',SqlTxt) then<br> begin<br> Delete(SqlTxt,1,6);<br> SqlTxt:=Trim(SqlTxt);<br> if Pos('FROM ',UpperCase(SqlTxt))>0 then<br> Delete(SqlTxt,1,4);<br> SqlTxt:=Trim(SqlTxt);<br> if Pos('INTO ',UpperCase(SqlTxt))>0 then<br> Delete(SqlTxt,1,4);<br> SqlTxt:=Trim(SqlTxt);<br> if Not StrIsEmpty(SqlTxt) then begin<br> i:=1;<br> While (i <= Length(SqlTxt)) and (Not StrIsEmpty(Sqltxt)) do begin<br> TableName:=TableName+SqlTxt;<br> Inc(i);<br> End;<br> end;<br> end;<br>end;