Dim ADORS As New ADODB.Recordset
Dim mysql As String
With ADOCN
'here how to call odbc from ADO!
.ConnectionString = "DSN=odbc namet;UID=YOURUSERID;PWD=YOURPASSWORD;"
.Mode = adModeReadOnly
.Open
End With
With ADORS
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.ActiveConnection = ADOCN
mysql = "select whatever from my table"
.Source = mysql
.Open
'for good preformance, I did store the record set in variant type variable so I can disconnect from host sooner
.ctiveConnection = Nothing
myrows = .RecordCount
mycola = .Fields.Count
mydata = .GetRows()
'now I can loop through my result
No comments:
Post a Comment