Please provide more details, code fragments etc.
Thank you for your reply,
I have tried the following code to write to one field, but all records.
procedure TForm4.Distance(p: TlatLon);
var
i, n, rc: integer;
lat, lon: double;
fLat, fLOn, fDist: Tfield;
da : TDistance;
begin
n := 0;
with SQLquery1 do
begin
DisableControls;
try
fLat := FieldByName('LATITUDE');
fLOn := FieldByName('Longitude');
fDist := FieldByName('Dist');
First;
while not EOF do
begin
lat := fLat.AsInteger / 10000; //10000 to convert
lon := -fLon.AsInteger / 10000;
da := getDistance(p, getVect(lat,lon));
edit;
fDist.AsFloat := da.dist;
//post;
Next;
end;
finally
UpdateMode := upWhereAll;
ApplyUpdates;
EnableControls;
end;
end;
end;1. While the code seems to work, there are gaps. It seems, randomly, that the fDist field is null. Most of the time,though, the fDist field holds the correct value.
2. If I access a larger table (i.e. tv_eng_data from CDBS website) and try the same procedure as above, the application self terminates after about 30 seconds.
I use the same procedure with XBASE and never had a problem, even with much larger tables.
The GetDistance (not to be confused with the Distance procedure) is a simple spherical trigonometry function that returns both distance and angle between two points on the Earth's surface. Only the distance parameter is used to test the function, but will use both parameters if a solution can be found. I will be happy to provide additional code if needed.
Thank you, Rob