Thread: Search Engine
View Single Post
Old Apr 1st, 2005, 8:50 AM   #8
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
here's some sql that i would use.

SELECT * FROM movies WHERE item LIKE 'M%'

then if you wanted to automate the deal, just have a array with the three table names in it. Then put a for loop around it. then replace the table with the varible.

so something like this:

//var declair
string sql;
string[] tables = new string[2];
tables[0] = "movies";
tables[1] = "games";
tables[2] = "music";
//now we need the for loop:
for (int x=1; x<2; x++)
         //now to build the sql string
         sql = "SELECT * FROM " << tables[x] << " WHERE item LIKE 'M%'";
         //then do your select here, i would use another array to hold the results from each     select statment.


//then display the search results here.

did that help you get started?
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote