Visual Basic Script to Query .MDB Database via “MS Access Database” User DSN

Visual Basic Script to Query .MDB Database via “MS Access Database” User DSN

 
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "DSN=MS Access Database;"

objRecordset.CursorLocation = adUseClient
objRecordset.Open "SELECT * FROM Connection" , objConnection, _
    adOpenStatic, adLockOptimistic
objRecordset.MoveFirst()

Do Until objRecordSet.EOF
    Wscript.Echo "Connection Name: " & objRecordSet.Fields("ConnectName").Value
    objRecordSet.MoveNext
Loop

objRecordset.Close
objConnection.Close

.