阅读:1444回复:3
关于VB+MapX编程的问题
<P>代码是这样写的:
Dim conn As ADODB.Connection Dim rs As ADODB.Recordset Dim ds As MapXLib.Dataset Set conn = New ADODB.Connection Set rs = New ADODB.Recordset conn.ConnectionString = "Provider=SQLOLEDB;server=127.0.0.1;uid=sa;pwd=eeeee;DATABASE=xy;" conn.ConnectionTimeout = 30 conn.Open rs.Open " select * from xy ", conn, 1, 1</P> <P>BindlayerObject.LayerName = "newl" 'BindlayerObject.Filespec = App.Path + "\mytabss1.tab" '若不指定,则为临时表 BindlayerObject.RefColumn1 = "X" BindlayerObject.RefColumn2 = "Y"</P> <P>BindlayerObject.LayerType = miBindLayerTypeXY Set ds = Map1.Datasets.Add(miDataSetADO, rs, "yuxi", "name", "ID", BindlayerObject)</P> <P> '字体颜色</P> <P> Map1.Layers.Item("newl").LabelProperties.Style.TextFontColor = miColorPurple</P> <P> Map1.Layers.Item("newl").LabelProperties.Style.TextFontHalo = True Map1.Layers.Item("newl").LabelProperties.Style.TextFontBackColor = miColorWhite</P> <P> '设置图元显示的标签</P> <P> <FONT color=#ff0000>Map1.Layers.Item("newl").LabelProperties.Dataset = ds(执行到这一句的时候就报错“时实错误‘1050’列参数无效。) </FONT> Map1.Layers.Item("newl").LabelProperties.DataField = ds.Fields.Item("name")</P> <P> Map1.Layers.Item("newl").LabelProperties.LabelZoom = True</P> <P> Map1.Layers.Item("newl").AutoLabel = True</P> <P>rs.Close conn.Close</P> <P>请大家帮我看一下到底是那弄错了???谢谢先~!</P> |
|
1楼#
发布于:2004-08-19 12:41
<P><FONT color=#ff0000>Map1.Layers.Item("newl").LabelProperties.Dataset = ds</FONT></P><P><FONT color=#ff0000>的前面加上SET看看!</FONT></P>
|
|
2楼#
发布于:2004-08-19 13:41
<P>谢谢老大,可以了,我弄了一上午啊~~!!!</P><P>十分感谢~!!!!</P>
|
|
3楼#
发布于:2004-10-10 06:24
<img src="images/post/smile/dvbbs/em01.gif" />
|
|