2012年4月3日 星期二
[ADOX]印出查詢中的SQL指令
Sub test()
Dim objConn As Object, objCat As Object, Prc As Object, i As Long
Set objConn = CreateObject("adodb.connection")
Set objCat = CreateObject("adox.catalog")
With objConn
.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=myPath\泛myAccess.mdb"
.Open
If .State <> 1 Then Exit Sub
End With
On Error GoTo errHandle
With objCat
.activeconnection = objConn
i = 1
For Each Prc In objCat.procedures
Cells(i, 1).Value = Prc.Name
Cells(i, 2).Value = Prc.Command.CommandText
i = i + 1
Next
End With
objConn.Close
Exit Sub
errHandle:
objConn.Close
End Sub
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言