Hi all - total newbie to DB programming, so bear with me....
I am using a Recordset object, and am trying to implement a search, but am
not having luck finding what I need.
I would like to enter a partial name, and seek records that contain that
string, rather than equal it. All I can find for relational operators are
=, <=, >=, >, and <.
How would I go about doing a "contains" search?
Thanks! 3 4507
sql: like *blabla*
Boobbbbbb heeft geschreven in bericht ... Hi all - total newbie to DB programming, so bear with me....
I am using a Recordset object, and am trying to implement a search, but am not having luck finding what I need.
I would like to enter a partial name, and seek records that contain that string, rather than equal it. All I can find for relational operators are =, <=, >=, >, and <.
How would I go about doing a "contains" search?
Thanks!
"Boobbbbbb" wrote OK... So I tried to use '*' as wildcards in this program line: datNLA.Recordset.Seek "=", "*Boo*" and it does not work. :( Would I have to convert this to a SQL query?
If so, how? Again, I'm a total noob to doing this kind of thing in VB.
Assuming you've dim your database and necessary variables used below, then:
(replace the parts in <> with the appropriate info')
Sub SearchDatabase()
'sub to search a database and assign the results to variables.
'Make up the search term:
strSQLString = "SELECT * FROM <table> WHERE <field> LIKE '<search term /
variable>' "
'Search the database with it:
Set rs<yourRecordSetQuery> = db<yourdatabase>.OpenRecordset (strSQLQuery,
dbOpenForwardOnly)
'Assign appropriate variables using returned search results:
While Not rs<yourRecordSetQuery>.EOF
arr<YourArray>[intCount] = rsQuery![<field>]
intCount = intCount + 1
rs<YourRecordSetQuery>.MoveNext
Wend
End Sub
On Sat, 19 Jul 2003 14:39:49 GMT, in comp.lang.visual.basic
"Boobbbbbb" <ar****************@earthlink.net> wrote: | Hi all - total newbie to DB programming, so bear with me.... | | I am using a Recordset object, and am trying to implement a search, but am | not having luck finding what I need. | | I would like to enter a partial name, and seek records that contain that | string, rather than equal it. All I can find for relational operators are | =, <=, >=, >, and <. | | How would I go about doing a "contains" search?
What database are you using?
In Access you can use
SELECT * FROM table WHERE fieldname like '*" & searchtext & "*'";
If mySQL /SQL Server use:
SELECT * FROM table WHERE fieldname like '%" & searchtext & "%'";
--------------------------------------------------------------- jn****@yourpantsbigpond.net.au : Remove your pants to reply
--------------------------------------------------------------- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: donald |
last post by:
Hi all, I have a website running asp (about to move to asp.net soon though)
which has a list of DVD's I have the various pages I want, last 10, listing,
full listing ect, but the one page i can't...
|
by: Tim Mavers |
last post by:
I have a series of database objects that represent things such as people,
accounts, etc. I have a set of options (boolean) that I need to add to
these objects. Normally I would just create a bit...
|
by: Trevor.D.Matthews |
last post by:
I need to develop a scheduling app and am having trouble with the
database
design. I can easily design a table hold appointments with start and
finish
times, but I always have an issue when it...
|
by: Dan |
last post by:
Hi. I'm having a problem with searching a databse entry. I'm new to dotnet
and still trying to figure some things out.
In order to locate a row in an access databse file .mdb, i am using this...
|
by: jaYPee |
last post by:
i am searching a lot of resources in the net that discusses about
database programming. i'm still searching on it and would like to
received any links that discusses about database programming in...
|
by: Alex Biddle |
last post by:
Hey there.
I was wondering whether Python had any support out-of-the-box for
database functionality, or database-like functionality.
For instance a lot of shared hosts have Python installed,...
|
by: vonclausowitz |
last post by:
Hi All,
I was thinking of creating a table in my database to index all words in
the database.
That way I can quickly search for one or more words and the index table
will return the
words and...
|
by: Stephan |
last post by:
Hi all,
I am new to access and I face the following "issue":
I would like to create a database, to which users can upload files
(=pdf, doc, xls...). The files shall be stored locally on a...
|
by: ischwartz88 |
last post by:
Hi, I am not a computer programmer. I have been learning VBA along the way of making this script. I know Access and SQL.
I have a very large database with many tables and queries. My goal is to...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |