to question:
I build a datasource,which names as test.It connect to a dbase3's dbf
name is fff.dbf,it contains two segments, Id and NNN.
procedure TForm1.Button1Click(Sender: TObject);
var
mylyr:Imomaplayer;
reltbl:IMoTable;
recs:IMORecordset;
count:integer;
field:IMofield;
value:string;
begin
reltbl:=cotable.Create as IMotable;
reltbl.Database:='TEST';
reltbl.Name:='fff.DBF';
mylyr:=map1.Layers.Item(0) as IMomaplayer
if mylyr.AddRelate('STATE_ID',reltbl,'ID',true) then
begin
memo1.Clear;
showmessage('connect suss');
end
else
showmessage('connect error!');
recs:=mylyr.Records;
count:=recs.Count;
////////show results
while count > 0 do
begin
field:=recs.Fields.Item('NNN');
value:=field.ValueAsString;
recs.MoveNext;
memo1.Lines.Add(value);
count:=count-1;
end;
****codes above runs very well in my computer. delphi version is 5.0.