[求助]大家帮我看看我的代码错误出在那?
<P>下面是一个根据数据库里主键值添加扩展数据的代码,它的运行结果总是满足不了要求请教高手们.<BR>Private Sub kzsj(obj As AcadEntity, cn, dwname) '加扩展数据<BR>Dim sjk As New ADODB.Recordset<BR>Dim id As Long<BR>id = 0<BR>sjk.Open "select * from tysx order by cadid asc ", cn, adOpenDynamic, adLockReadOnly<BR>Do While Not sjk.EOF<BR> id = sjk.Fields("cadid")<BR> sjk.MoveNext<BR>Loop<BR>sjk.Close<BR>For Each obj In ThisDrawing.ModelSpace<BR>Dim xtype As Variant<BR>Dim xdata As Variant<BR>obj.GetXData "", xtpye, xdata<BR>If IsEmpty(xtype) Then '判断是否有扩展数据。(不知是不是这里不对)我想判断在它没有扩展数据的时候添加}<BR>Dim datatype(0 To 7) As Integer<BR>Dim data(0 To 7) As Variant<BR>datatype(0) = 1001: data(0) = "tete"<BR>datatype(1) = 1000: data(1) = dwname<BR>datatype(2) = 1003: data(2) = "0"<BR>datatype(3) = 1040: data(3) = 1.232<BR>datatype(4) = 1041: data(4) = id + 1<BR>datatype(5) = 1070: data(5) = 5656<BR>datatype(6) = 1071: data(6) = 32332<BR>datatype(7) = 1042: data(7) = 10<BR>obj.SetXData datatype, data<BR>id = id + 1<BR>End If<BR>Next obj</P><P>End Sub</P> IsEmpty(xtype)改为VarType(xData) <> 0试试 <P>我想判断图元是否有扩展数据没有就添加扩展数据.我改为VarType(xData) <> 0后还是老样子.</P>
<P>同一图形我运行几次data(4)的值总是在增大</P> 大家帮我看看我的代码错误出在那? :
;错误Xsub(L) 指令(偏移代码) 错误:25879 88
页:
[1]