-
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.
-
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.
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks