Searching an ADO database with a VB program?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Searching an ADO database with a VB program?

  1. #1
    Randy Guest

    Searching an ADO database with a VB program?


    This probably sounds dumb but I am creating a VB program that connects to
    an Access database.

    My question is. In DAO there is a NoMatch propertie for the Recordset but
    ADO doesn't have this, so if I search the database field using the Find method
    it works ok but what do I do if it doesn't find anything. I used to use the
    NoMatch propertie when it didnt find a result. How do yuo go about doing
    this in an ADO recordset.

    I am using the ADO data control to connect to the database.

    Thank you for any help. PS please email the response if you can.

  2. #2
    Dante Guest

    Re: Searching an ADO database with a VB program?


    Try this:

    adodc1.Recordset.Find "ColumnName ='" & strSearch & "'"

    if adodc1.Recordset.EOF then
    msgbox "Not found"
    endif


    "Randy" <RCOOL217@aol.com> wrote:
    >
    >This probably sounds dumb but I am creating a VB program that connects to
    >an Access database.
    >
    >My question is. In DAO there is a NoMatch propertie for the Recordset but
    >ADO doesn't have this, so if I search the database field using the Find

    method
    >it works ok but what do I do if it doesn't find anything. I used to use

    the
    >NoMatch propertie when it didnt find a result. How do yuo go about doing
    >this in an ADO recordset.
    >
    >I am using the ADO data control to connect to the database.
    >
    >Thank you for any help. PS please email the response if you can.



  3. #3
    Igor Guest

    Re: Searching an ADO database with a VB program?


    "Randy" <RCOOL217@aol.com> wrote:
    >
    >This probably sounds dumb but I am creating a VB program that connects to
    >an Access database.
    >
    >My question is. In DAO there is a NoMatch propertie for the Recordset but
    >ADO doesn't have this, so if I search the database field using the Find

    method
    >it works ok but what do I do if it doesn't find anything. I used to use

    the
    >NoMatch propertie when it didnt find a result. How do yuo go about doing
    >this in an ADO recordset.
    >
    >I am using the ADO data control to connect to the database.
    >
    >Thank you for any help. PS please email the response if you can.


    Hi,
    In ADO you have to check for Recordset's End of File or Beginning
    of the File Property(depending which direction are you going).

    ' For example You are looking for Something going forward
    rst.MoveFirst
    rst.Find "Country='Russia'", , adSearchForward
    if not rst.EOF then
    'You Found Country
    boolFound=True
    endif


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center