- 积分
- 5987
- 明经币
- 个
- 注册时间
- 2006-7-8
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2008-7-30 08:56:00
|
显示全部楼层
SQL-TXT方法-
- Function CAdToText(InputFileName)
- Dim LineData As AcadLine, ArcData As AcadArc
- Close #1
- Open InputFileName For Output As #1
-
- Write #1, "m1", "m2", "m3", "m4", "m5", "m6", "m7", "m8", "m9", "m10", "m11", "m12"
-
- Write #1, m1, m2, m3, m4, m5, m6, m7, m8, m9
-
- Next ent
-
- Close #1
-
- End Function
- Function SQLRecordsetFromTxt(InputFileName As String) As ADODB.Recordset
- Set conn = CreateObject("ADODB.Connection")
- Set rs = CreateObject("adodb.recordset")
- conn.Open "DRIVER={Microsoft Text Driver (*.txt; *.csv)};DBQ=d:", "", ""
- rs.Open " " & InputFileName, conn, 1, 3
- Set RecordsetToExcel = rs
- End Function
- 主程序:
- Sub Main()
- abc = "select "
- abc = abc & " m7,m2,m4,m5,m6 from temp.txt where m1 = 'AcDbText' "
- Set rsText = SQLRecordFromTxt(abc)
- End Sub
|
|