Searching VB databases
Searching VB databases
Hi,<p>I have a smalll VB app that uses a database. It has 2 fields on the table, one a text and another a memo. I need a way to search the databases by the title and display them. How do I do this?
-
- Posts: 1918
- Joined: Fri Aug 22, 2003 1:01 am
- Location: Izmir, Turkiye; from Rochester, NY
- Contact:
Re: Searching VB databases
Create a dialog, on the dialog put a text box for entering title, a listview box for displaying results, and a button to start the search. Make query to search titles when button is clicked.
Dale Y
Re: Searching VB databases
Mike,<p>Which type of database? Access, SQL, FOXpro?
Re: Searching VB databases
The querying is what i don't know how to do. <p>I am using VB5 Pro and a access 2000 database.<p>Oh, and greg, you never responded about getting VB6. if you could, e-mail me about it. Thanks!<p>Thanks, Mike
-
- Posts: 1918
- Joined: Fri Aug 22, 2003 1:01 am
- Location: Izmir, Turkiye; from Rochester, NY
- Contact:
Re: Searching VB databases
index database on title field.<p>in Access 2K select Query tab, Design button. I think you want FIND FOR (string var passed from VB when it calls the query) IN field title. That's if using COM interface in VB.<p>else, load the database into a 2 dimensional array in VB. then compare the input string to the first dimension in each array element. when a match is found, that is the answer. Note - this requires an exact match! Multiple answers on partial matches (ie: 007 returns all James Bond movies) is harder. One step at a time!<p>When you get it almost working, post some code and somebody (maybe me) will make suggestions about fixes.
Dale Y
-
- Posts: 9
- Joined: Thu Dec 04, 2003 1:01 am
- Contact:
Re: Searching VB databases
Mike,<p>Try:
SELECT `name_of_title_feild`, `name_of_memo_feild` FROM `name_of_table` WHERE `name_of_title_feild` LIKE '%search_term%'<p>This is a MySQL query but I believe VB will be the same, SQL is 90% standardized.<p>The "%" before and after the search term are wild cards and will match anything before or afterwards.<p>You will need to separate the search terms and do a loop as well to search each term individually.<p>This is just a simple search and will not be anything like Google, to get closer to Google you need to do a lot more coding.<p>If needed I can give you some more code of a little more robust queries.<p>A great book for learning SQL is Sams teach yourself SQL in 10 minutes.<p>Eddie
SELECT `name_of_title_feild`, `name_of_memo_feild` FROM `name_of_table` WHERE `name_of_title_feild` LIKE '%search_term%'<p>This is a MySQL query but I believe VB will be the same, SQL is 90% standardized.<p>The "%" before and after the search term are wild cards and will match anything before or afterwards.<p>You will need to separate the search terms and do a loop as well to search each term individually.<p>This is just a simple search and will not be anything like Google, to get closer to Google you need to do a lot more coding.<p>If needed I can give you some more code of a little more robust queries.<p>A great book for learning SQL is Sams teach yourself SQL in 10 minutes.<p>Eddie
Re: Searching VB databases
I was basically asked to create a program that will organize recipies. So, all I need to do is let the user type a recipie name and it show up.
Who is online
Users browsing this forum: No registered users and 53 guests