不会吧,我也是9月份才开始学MapX。
绑定数据很简单啊。
首先,你要保证在你的地图文件中必须定义了一个Index字段。
procedure AddData();
var
Flds: CMapXFields;
MapDS: MapXlib_TLB.dataset;
Lyr: CMapXLayer;
DS: TADODataSet;
rs: _Recordset;
bindlyr,GFld: string;
const
miTypeString: integer = 0;
miTypeNumeric: integer = 1;
miTypeDate: integer = 2;
miTypeInt: integer = 3;
miTypeSmallInt: integer = 4;
miTypeFloat: integer = 5;
miTypeLogical: integer = 6;
miDataSetADO: integer = 12;
begin
Flds :=CoFields.Create;
DS :=TADODataSet.Create('ADODataSet控件');
DS.Connection :='ADOConnection控件';
DS.CommandText :='select Code....';
DS.Open;
rs :=DS.Recordset;
if not rs.EOF then
begin
Flds.Add('Code', 'Code', miAggregationIndividual, miTypeString);
Flds.Add('*', 'R_Name', miAggregationIndividual, miTypeString);
GFld :='Code';
//Code为要绑定图层上的Index字段
bindlyr :='要绑定的图层名';
MapDS :=curMap.Datasets.Add(miDataSetADO,rs,bindlyr,GFld,EmptyParam,bindlyr,Flds,EmptyParam);
end;
end;