Results 1 to 4 of 4

Thread: Parsing Strings to use in SQL commands

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Charleston, S.C.
    Posts
    21

    Parsing Strings to use in SQL commands

    What I am trying to do is show the user database information formatted all nice and pretty in a list box, and when the user clicks on one of the list items, I would like to have the string displayed in the list item parsed out using the Split( ) function and then used in an SQL statement to find the record they selected.

    I can get the string parsed out using Split( ) into an array, but how could I then query the database on this string? For instance, could I use 'SELECT * FROM TABLENAME WHERE COLUMNAME = 'stringArray(0)' or something similar to this and just iterate through the stringArray( )?

    I know the items in the List Box will be ordered in a certain way so that each time Split( ) is called I will at least know what the very last item is. What is giving me problems, is sometimes there will be blanks. For example, in the first row of the List Box, there will be items such as Name, Address, Phone Number, . . . . , Email, etc. Sometimes some of the items will be blank.

    Could I just use 'SELECT * FROM TABLENAME WHERE * = 'stringArray( )', so that I get a constantly smaller recordset returned each time?

    Any ideas or thoughts would be appreciated, because has been bugging me for the past few days.

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    might just be me thats slow, but I don't get it.
    Could u explain a bit more in detail exactly what u want to do?

    u want to fill the listbox with data from the db, the requery more info on the selected item and show this to the user?
    -= a peet post =-

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Charleston, S.C.
    Posts
    21

    Sorry about the confusion

    Let me explain, no there is too much, let me summarize.

    What I would like to know is how you could search a database by set of tokens that you get by using Split( ). I have a space delimited string that can differ in the number of tokens. I would like to be able to search a DAO database using these tokens in an SQL statement.

    What I would like to know is if the number of tokens can differ in each string, is there any way to have an SQL statement filter all of the possible combinations of these tokens to return the record set associated with that string?

    I guess in other words, I would like to sort out the particular recordset based on the tokens provided by the string chosen.

    I hope this helps.

  4. #4
    Hyperactive Member
    Join Date
    Sep 2001
    Location
    Orlando
    Posts
    392
    Could you leave that 'possible combination' part?
    No? Better get a full text search engine.
    Abu Haider
    ____________________________
    100% Data Validation for the MS DataGrid Control. Plus Support for Custom and Foreign Lists, DatePicker and much more...
    The DataGridEnhancer


    I often point to a place where the problem has been discussed, instead of giving you the code that solves it. This is for good, may be you will understand some day...

Posting Permissions

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



Click Here to Expand Forum to Full Width