J
jiordano
Unregistered / Unconfirmed
GUEST, unregistred user!
我用delphi+mapx,利用odbc引入excel表,表里有基站位置的经纬度信息,我用bindlayer想把每个基站在地图上标示出来。可是程序提示custom dataset error,不知哪里出错了,还望指出,谢谢!程序如下:
procedure TForm1.Button2Click(Sender: TObject);
var
bindlayerobject,par:variant;
ds:cmapxdataset;
begin
par:=createoleobject('mapx.odbcqueryinfo.4');
par.SqlQuery := 'select [sheet1$].longitude,[sheet1].latitude from [sheet1$];';
par.DataSource := 'CS';
par.ConnectString := 'Provider=MSDASQL.1;Password=538635;Persist Security Info=True;User ID=jiordano;Data Source=CS;Mode=Read;Extended Properties=excel 2002;Initial Catalog=E:/incoming/poject/CS_Chendu;';
BindLayerObject:= CoBindLayer.Create;
BindLayerObject.LayerName := 'mytab';
BindLayerObject.FileSpec := 'e:/incoming/project/map/map/mytab.tab';
BindLayerObject.refcolumn1:='longitude';
//excel中的坐标
BindLayerObject.RefColumn2 :='latitude';
//
BindLayerObject.LayerType := miBindLayerTypeXY;
ds:=Map1.Datasets.Add(miDatasetODBC, emptyparam, 'my', 'longitude', 'latitude', BindLayerObject, EmptyParam, false);
end;
procedure TForm1.Button2Click(Sender: TObject);
var
bindlayerobject,par:variant;
ds:cmapxdataset;
begin
par:=createoleobject('mapx.odbcqueryinfo.4');
par.SqlQuery := 'select [sheet1$].longitude,[sheet1].latitude from [sheet1$];';
par.DataSource := 'CS';
par.ConnectString := 'Provider=MSDASQL.1;Password=538635;Persist Security Info=True;User ID=jiordano;Data Source=CS;Mode=Read;Extended Properties=excel 2002;Initial Catalog=E:/incoming/poject/CS_Chendu;';
BindLayerObject:= CoBindLayer.Create;
BindLayerObject.LayerName := 'mytab';
BindLayerObject.FileSpec := 'e:/incoming/project/map/map/mytab.tab';
BindLayerObject.refcolumn1:='longitude';
//excel中的坐标
BindLayerObject.RefColumn2 :='latitude';
//
BindLayerObject.LayerType := miBindLayerTypeXY;
ds:=Map1.Datasets.Add(miDatasetODBC, emptyparam, 'my', 'longitude', 'latitude', BindLayerObject, EmptyParam, false);
end;