vbs如何连接access数据库?是07版以后的,后缀是*.accdb不是*.mdb

网上找了一圈的都是老版的,连不上啊O.O
2024-11-22 12:33:34
推荐回答(2个)
回答(1):

回答(2):

Sub main
CreateDB()
End Sub

Sub CreateDB()
str=""
Set Mdb = Wscript.CreateObject("ADODB.Connection")
strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" & "Data Source=" & "D:\Database.accdb" & ";"
Mdb.Open strConnection
Set Schema = Mdb.OpenSchema( 20 ,Array(Empty,Empty,Empty,Empty) )
Do while not Schema.EOF
str = str & "、" &Schema.Fields( "TABLE_NAME" ).Value
Schema.MoveNext
Loop
Mdb.Close()
Wscript.Echo str
End Sub

main