laoxie_198 发表于 2006-10-20 08:52:00

[求助]我的根据库里坐标绘pl线时遇到的问题

本帖最后由 作者 于 2006-10-20 13:59:52 编辑 <br /><br /> <P>我大伙帮我看看我的vba怎么回事!</P>
<P>Sub ll()<BR>Dim cn As New ADODB.Connection<BR>Dim rst As New ADODB.Recordset<BR>Dim klj, blj, blj2 As String<BR>Dim tysx As String<BR>Dim id, js As Long<BR>Dim i As Integer<BR>Dim objpline As AcadLWPolyline<BR>blj = "select * from pline"<BR>klj = "provider=sqloledb.1;password=;persist security info=true;user id=sa;initial catalog=cadsql ;data source=huangbin" '库连接字符串<BR>'klj = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=hbsql"<BR>cn.Open klj '连接数据库<BR>rst.Open blj, cn, adOpenForwardOnly, adLockBatchOptimistic<BR>Dim pt() As Variant<BR>Do While Not rst.EOF<BR>js = js + 1<BR>&nbsp;&nbsp; rst.MoveNext<BR>Loop<BR>rst.Close<BR>ReDim pt(js - 1, 2)<BR>rst.Open blj, cn, adOpenForwardOnly, adLockBatchOptimistic<BR>i = -1<BR>Do While Not rst.EOF<BR>&nbsp;&nbsp; i = i + 1<BR>&nbsp;&nbsp; pt(i, 0) = rst.Fields("x")<BR>&nbsp;&nbsp; pt(i, 1) = rst.Fields("y")<BR>&nbsp;&nbsp; pt(i, 2) = 0<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp; rst.MoveNext<BR>Loop<BR>'ThisDrawing.ModelSpace.AddLine pt<BR>Set objpline = ThisDrawing.ModelSpace.AddLightWeightPolyline_(pt)<BR>rst.Close<BR>cn.Close</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; <BR>End Sub</P>
<P>总是提示说:对象不支持该属性或方法!</P>
<P>我是刚接触vba的请高手们赐教!!!</P>

Tiptoe 发表于 2006-10-20 09:55:00

<P>AddLightWeightPolyline(pt)</P>
<P>该pt是一组二维的坐标值,没有z值的,把z值去掉就能通过了</P>

laoxie_198 发表于 2006-10-20 11:15:00

请问我把z值去掉了怎么还是不行的?

laoxie_198 发表于 2006-10-20 13:58:00

高手们指点指点我!我是百思不得其解呀~
页: [1]
查看完整版本: [求助]我的根据库里坐标绘pl线时遇到的问题