本帖最后由 作者 于 2008-5-3 19:34:10 编辑
Private Sub CommandButton1_Click() Dim i As Integer Dim lineobj As Object Dim startpoint(0 To 2) As Double Dim endpoint(0 To 2) As Double Dim wk As DAO.Workspace Dim db As DAO.Database Dim rec As DAO.Recordset Set wk = CreateWorkspace("wk", "Admin", "", dbUseJet) Set db = wk.OpenDatabase(ThisDrawing.Application.Path & "\1.mdb", , ",") Dim strsql As String strsql = "select * from points" Set rec = db.OpenRecordset(strsql) rec.MoveFirst Do While Not rec.EOF startpoint(0) = rec.Fields("x1") startpoint(1) = rec.Fields("y1") startpoint(2) = 0 endpoint(0) = rec.Fields("x2") endpoint(1) = rec.Fields("y2") endpoint(2) = 0 Set lineobj = ThisDrawing.ModelSpace.AddLine(startpoint, endpoint) rec.MoveNext Loop rec.Close db.Close wk.Close Unload Me End Sub
|