驱动程序和 SQL 来把 Text 文件转换成 Access MDB 数据库文件,首先,为文本文件创建一个 SCHEMA.INI
文件。然后,你可以使用下面的代码来实现转换:
Dim db As Database, tbl as TableDef
Set db = DBEngine.CreateDatabase(App.Path & "/mymdb.mdb", dbLangGeneral, dbVersion_0)
Set tbl = db.CreateTableDef("Temp")
tbl.Connect = "Text;database=c:\vbpj\data"
tbl.SourceTableName = "Customer#txt"
db.TableDefs.Append tbl
db.Execute "Select Temp.* into NewTable from Temp"
db.TableDefs.Delete tbl.Name
db.Close
Set tbl = Nothing
Set db = Nothing
文章来源于领测软件测试网 https://www.ltesting.net/