 |

05-09-2002, 03:26 PM
|
|
|
how do you search a database
|
can you give a text box the ability to search a database, and if so how
|
|

05-09-2002, 03:33 PM
|
 |
Keeper of foo
Retired Moderator * Guru *
|
|
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
|
|
|
I tried to think of some witty reply to this, but failed. If I have to answer your question strickly, the only answer I can give you is No. A textbox cannot search a database. Now... you could write code to search a database for the value placed in a textbox. Is this really what you're asking?
|
|

05-13-2002, 08:03 AM
|
|
|
|
yes thats what i need. thank you
|
|

05-13-2002, 08:45 AM
|
|
Junior Contributor
|
|
Join Date: Dec 2001
Location: at work... probably :-(
Posts: 366
|
|
Please supply more information like the data base you are trying to query. This question is very broad, it covers a lot of what many programmers spend their careers doing! There is a lot of coding to be done for solve your problem. Try to break the problem down and into smaller chunks as ask these more specific questions. It sounds like this is a new area for you. It may well be worth investing time and money in a book. There are plenty of books recommmended in this forum.
Good Luck 
|
__________________
(A)bort, (R)etry, (G)et a beer?
|

05-13-2002, 10:12 AM
|
 |
C# Lover
* Expert *
|
|
Join Date: Jan 2002
Location: 00-80-C8-C3-2E-52
Posts: 1,899
|
|
if you had a textbox called "txtSearchLastName" then you could use the value in it to search the database with something like this (using ADO):
Code:
RS.Open "SELECT * FROM [tblPeople] WHERE [LastName]='" & txtSearchLastName.Text & "'", adoConString
This would populate the recordset with people from the table whose last name is exactly the value in the textbox.
|
__________________
"Man is still the best computer we can put aboard a spacecraft...and the only one that can be mass produced with unskilled labor." - Wernher von Braun
|

05-13-2002, 01:52 PM
|
 |
|
|
Join Date: Mar 2002
Location: Ohio, USA
Posts: 1,552
|
|
Same thing
|
I am trying to do the same thing. Search my Database and then place the results in an MSHFlexGrid named msh.
How would the best way to do this.
Thanks in advance
Chris
|
__________________
Chris
|

05-13-2002, 02:07 PM
|
 |
Contributor
|
|
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
|
|
|
Maybe it's better to use sql for your purposes, but I thought I'd mention that if you already have recordsets in your application, you can also take a look at the methods Sort, Filter, and Search.
An example of the search would be ...
rsStudents.Find "Last_Name = '" & txtSearch.text & "'"
just an idea.
|
|

05-13-2002, 02:08 PM
|
 |
Contributor
|
|
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
|
|
|
sorry, I didn't mean Sort, Filter, and Search.
I meant Sort, Filter, and Find.
|
|

05-13-2002, 02:18 PM
|
 |
|
|
Join Date: Mar 2002
Location: Ohio, USA
Posts: 1,552
|
|
|
Cogen , Could you explain how I could list all record with "Pizza" (just an example) in the Description Colume, Which one of the thing you listed would I use. Then list it in the MSHFlexGrid (msh)
Sorry, I'm new to using a Database
Chris
|
__________________
Chris
|

05-13-2002, 02:35 PM
|
 |
Contributor
|
|
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
|
|
honestly, I'm not that familiar with the MSHFlexGrid, so I can't really help you there, but as far as returning all records with Pizza in the description column, you would use .Filter. The main thing to remember is that those methods do not take the place of your SQL query, but they can narrow an already existing query into your search information.
For example, you would still need a recordset that is fully populated (probably by sql).
Maybe using SELECT * FROM table_name. (that's pretty broad though).
Then, with the recordset that contains the returned data, you can narrow the recordset down by using the filter method.
rsRecordSet.Filter "Description = 'Pizza'"
Now you can use the rsRecordSet as you normally would, however only the records with Pizza in the Description will be available.
Then, when you are done displaying the information, you can reset the recordset back to it's original state by using ...
reRecordSet.Filter = adFilterNone
I hope that helps ... 
|
|

05-13-2002, 03:31 PM
|
|
Junior Contributor
|
|
Join Date: Mar 2002
Posts: 270
|
|
Hi Chrisoo,
After you query the database you can use this line to populate the flex grid.
Set myGoodGrid.Recordset = myGoodRecordset
Edit:
Thats cool, I never took into account some peoples background may have been white. 
|
Last edited by dcl3500; 05-13-2002 at 03:55 PM.
|

05-13-2002, 03:40 PM
|
 |
Mostly Harmless?
Retired Moderator * Expert *
|
|
Join Date: Jun 2001
Location: Western Illinois, USA
Posts: 2,398
|
|
Sorry Matticus_99 for editing that post, but pink was just too darn hard to see. 
|
__________________
Don
"So long and thanks for all the fish.'" - Douglas Adams.
|

05-13-2002, 03:41 PM
|
|
|
|
i am trying to make a serchable japanese to english/ english to japanese dictionary with 2 textboxes (1 for search and 1 for translation) and a search button. i wanted the database to store information like this (nihongo - japanese)
|
|

05-13-2002, 03:58 PM
|
 |
|
|
Join Date: Mar 2002
Location: Ohio, USA
Posts: 1,552
|
|
|
I did what all of your posts said. But is there a way I can get partial maches such as "box" would find Lunchbox.
Chris
|
__________________
Chris
|

05-13-2002, 04:01 PM
|
 |
Keeper of foo
Retired Moderator * Guru *
|
|
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|