這應該是DAO連線方法,請問如何改寫成ADO方法
Sub ABC()
Dim DB As Database
Dim RES As Recordset
Dim S As String
Connect$ = "ODBC;DSN=msndb;UID=eefg;PWD=a000user;"
Set DB = OpenDatabase("", False, False, Connect$)
Sheets("Sheet1").Select
S = " SELECT DTN FROM INDICES "
Set RES = DB.OpenRecordset(S, dbOpenSnapshot, dbSQLPassThrough)
Range("B8").CopyFromRecordset RES
End Sub
謝謝