-
Recordset and Namespace?
I've tried to implement this sub, but it seems that I'm needing a namespace or...?
Code:
Sub ADOFilterRecordset()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
' Open the connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=.\NorthWind.mdb;"
' Open the recordset
rst.Open "Customers", cnn, adOpenKeyset, adLockOptimistic
' Filter the recordset to include only those customers in
' the USA that have a fax number
rst.Filter = "Country='USA' And Fax <> Null"
Debug.Print rst.Fields("CustomerId").Value
' Close the recordset
rst.Close
End Sub
-
ADO.net is the current version of data access built into vs.net, I think if you need to use ADO itself, you can add this into your project by going to the:
Project Menu > Add Reference > COM tab
and adding in the Microsoft ActiveX Data Objects x.x Object Library from there.