Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Location
    Corpus Christi, Texas
    Posts
    132

    SQLite search within a string

    I have been looking around on the forum for about 2 hours and didn't find what i need help with.

    I'm needing help in finding out how to do a search inside my DB within a string.

    Exp: If i have a Table called "HELP" and one of the column is named "Notes" and ID 1 under "Notes" it = "The mouse jumped over the clock"

    How would i search inside all rows where "Notes" located for the word "mouse" and if sql finds one it gives me the ID.

    I kinda need a search like the one this site uses.

    Thanks for any help.

  2. #2
    Join Date
    Oct 2004
    Location
    East, South & West Asia
    Posts
    1,020
    Hi,

    You can study the method used under Roboblue's Customer DB App located at this examples site.

    In the APZ file, look for the search button and double click to see its code.

    You might want to use something similar to this. It might work.:

    Code:
    --Your variable that may come from input box named MySearch
    sSearch = Input.GetText("MySearch");
    if sSearch ~= "" then
    
    --This will output a table for the ID you're looking for:
    tblMySearch = SQLite.QueryToTable(db, "Select  ID,NOTES from HELP where (NOTES LIKE '%"..Input.GetText("MySearch").."%') ;
    
    if tblMySearch then
    --This will output your results to a ListBox:
    for nRow = 1,tblMySearch.Rows do
    	    	--add the item to the listbox called LB_Results 
    	    	ListBox.AddItem("LB_Results", tblMySearch.Data[nRow]["ID"], tblMySearch.Data[nRow]["NOTES"]);
    end -- endForLoop
    
    else
    
    Dialog.Message("Notice", "SEARCH NOT FOUND", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end -- if tblMySearch
    
    end -- if sSearch not empty
    Last edited by azmanar; 04-09-2006 at 12:40 AM.
    Newbie Examples
    ------> AMS 7.5 : amstudio.azman.info
    ----> AMS 6 & 5: www.azman.info/ams/
    ----> FB: facebook.com/GuideToWealth

    ----> Content Development Blog: www.AZMAN.asia

  3. #3
    Join Date
    Mar 2006
    Location
    Corpus Christi, Texas
    Posts
    132
    Thanks allot!

    I came up with this from your help

    ListBox.DeleteItem("ListBox1", -1);
    --Your variable that may come from input box named MySearch
    sSearch = Input.GetText("InputSearch");
    if sSearch ~= "" then
    OpenHelpDatabase();
    --This will output a table for the ID you're looking for:
    tblMySearch = SQLite.QueryToTable(Hdb, "Select ID,Details,Notes from HELP where (Details LIKE '%"..Input.GetText("InputSearch").."%')") ;

    if tblMySearch then
    --This will output your results to a ListBox:
    for nRow = 1,tblMySearch.Rows do
    --add the item to the listbox called LB_Results
    ListBox.AddItem("ListBox1", tblMySearch.Data[nRow]["ID"] .. ", " ..tblMySearch.Data[nRow]["Details"], tblMySearch.Data[nRow]["Notes"]);
    end -- endForLoop
    end
    CloseHelpDatabase();
    else

    Dialog.Message("Notice", "SEARCH NOT FOUND", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

    end -- if sSearch not empty
    and it works perfect.

    Is there a way for me to search for more then one word at a time?

    Like i could type in "mouse clock" and have it pick string that contains both words.

Similar Threads

  1. how to search for string over the whole project
    By Dimon in forum AutoPlay Media Studio 6.0
    Replies: 6
    Last Post: 03-22-2006, 04:49 PM
  2. Return String not including search term
    By threaded in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 08-14-2005, 10:31 AM
  3. search sqlite table
    By Roboblue in forum AutoPlay Media Studio 5.0
    Replies: 19
    Last Post: 01-20-2005, 06:16 PM
  4. SQLITE Search on CD
    By perry_d76 in forum AutoPlay Media Studio 5.0
    Replies: 4
    Last Post: 03-31-2004, 08:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts