title: ADOQuery, trigger and requery bug
body: <p>I have an ADOQuery that inserts a record to SQL Server 2005 table that has trigger inserting data to another table. I use following code to refresh the query and avoid <code>Row cannot be located for updating</code> (There are PKs on each table, UpdateCriteria property are set, Cursors are set to Dynamic, yet I still get the error sometimes. However it's not the question now).</p>
  
  <pre><code>procedure Requery(T: TCustomADODataSet; IDField: string);
  var
    i: integer;
  begin
    if T.RecordCount &gt; 0 then
      i := T.FieldByName(IDField).AsInteger;
    T.Requery();
    if T.RecordCount &gt; 0 then
      T.Locate(IDField, i, []);
  end;
  </code></pre>
  
  <p>Before requery, I can get value of ID field. However, after requery, ID field returns value of ID field of the other table record insterted by trigger. Both tables has ID field with same name. I have also added <code>SET NOCOUNT ON .... OFF</code> to trigger to avoid <code>Too Many Rows Affected</code> error, however I don't think this affects my problem. I haven't seen errors like these when I was working with Delphi 6 - 7 and SQL Server 2000, hence I'm willing to give <a href="http://www.devart.com/sdac/" rel="nofollow noreferrer">SDAC</a> or <a href="http://www.winsoft.sk/Adonis.htm" rel="nofollow noreferrer">DAO</a> a try. Would SDAC or DAO solve the problem or is there any solution without changing the ADOQuery?</p>