|
数据库文件:test.sqlite3,里面有两张表:基本信息表,设备材料库。同样的代码读入基本信息没有问题,设备材料库的内容无论如何读不进excel,但在sqlite3终端用同样的SQL语句 “SELECT * FROM 设备材料库;” 就没有问题,求大神帮忙
- Sub test()
- Dim conn As Object
- Set conn = CreateObject("adodb.connection")
- Dim connStr As String
- connStr = "Driver={SQLite3 ODBC Driver};Database=" & ThisWorkbook.Path & "\test.sqlite3"
- conn.Open (connStr)
- Dim rst As Object
- Set rst = CreateObject("adodb.recordset")
-
- Call rst.Open("SELECT * FROM 设备材料库;", conn)
- Call ThisWorkbook.Sheets(1).Range("A1").CopyFromRecordset(rst)
- rst.Close
- conn.Close
- End Sub
复制代码
|
|