Board index » delphi » Locate problem
Simon Bowyer
![]() Delphi Developer |
Tue, 23 Mar 2004 17:32:26 GMT
Locate problem
I am using the locate method to check if a record exists before adding it
again. I found a bug in my code and had to change the fields passed in locate. Now, the locate method fails to find the row even though it is in the database. My code is listed below. Both loops fail to find any matching rows. The fGang table is the amster of fGangResource and is on the correct GangId. The key to fGangResource is GangId, GangResourceId with ResourceId being another field. This is so a resource can exist in more than one gang. Does locate require the fields to be actual keys? Does locate require the fields to be in field order? Both tables are TADOTables and I'm using D5 Pro, ADO Express and Access 2000 as the db. Thanks in advance if fGangTable.Locate('GangId',fGang.GangId,[]) then begin // See if its been changed for i := 0 to fGang.Vehicles.Count - 1 do begin |