sqlite sorting

Discussion in 'Questions (Windows Mobile)' started by dennishea, Sep 12, 2008.

  1. dennishea

    dennishea Active Member Licensed User

    Help I can't seem to wrap my brain around sorting. If I have data in a colume that looks like this.

    Mach
    -----

    Tht2d
    Tht3
    Twf4
    T-I20

    When I enter txt like Tht in txtbox I would like to load Tht2d and Tht3 in table, not twf4 and T-I20 or if I load txtbox with Twf4 that is all I want to show up in table. I can't seem to figure out how to enter partial data and match up with data in database. Any help would be appreciated.

    denny
     
  2. BjornF

    BjornF Active Member Licensed User

    You can do it using wildcards (e.g. *).

    either with a table filter on the "local" table, e.g. Table1.Filter("FirstColumnContent LIKE 'tht*'"), or alternatively you could do a query to the SQLite database e.g. "SELECT * FROM MainTable WHERE FirstColumnContent LIKE 'tht*'"

    all the best / Björn
     
  3. Hennell

    Hennell Member Licensed User

    For some reason in SQLite the * wildcard is actually a %, so the command should be:

    "SELECT * FROM MainTable WHERE FirstColumnContent LIKE 'tht%'"

    This works best with the cmd.setparameter feature as you can add the '%' in within the code:

    Code:
    cmd.SetParameter("Search","%" & tbxSearch.Text & "%")
    cmd.CommandText = 
    "SELECT * FROM MainTable WHERE FirstColumnContent LIKE @Search"
     
  4. dennishea

    dennishea Active Member Licensed User

    Thanks BjornF and Hennell for your responses. I now am back out of the quag myer and progressing again. Thanks again to both of you for your help.

    :sign0188:

    dennishea :sign0060:
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice