Results 1 to 2 of 2

Thread: Recordset and Namespace?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Question 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

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    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.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width