DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Searching an MSFLEXGRID without typing in whole name

  1. #1
    Join Date
    Apr 2005
    Posts
    53

    Searching an MSFLEXGRID without typing in whole name

    HI,
    Currently I have an MSFLEXGRID with a search function. It works fine, However, I am using it for my DvD collection and for a title to show up in a search, you have to type the whole title in exactly.
    Currently I am using this..:

    Data2.RecordSource = "select * from CDs where Title = '" + search.Text + "'"

    which will just show whatever title i typed in the 'search.text' text box.

    However, I was wondering if it is possible to make it so that say for example, If 3 letters match then it will show them. So if i had in there...

    HARRY POTTER 1
    HARRY POTTER 2
    HARRY POTTER 3 (etc, you get the picture)

    then if i searched say, 'harry' or 'har' then all three would show up?

    Thanks,

    Jenks

  2. #2
    Join Date
    Dec 2004
    Location
    México DF
    Posts
    127
    Hi!

    You can use LIKE operator instead = operator in your SQL sentence, plus some wildcards:

    e.g.

    "select * from CDs where Title LIKE '" & search.Text & "*'"

    I think this should do the trick.

    HTH,

    mc

  3. #3
    Join Date
    Apr 2005
    Posts
    53

    ..

    Hi, I put in

    Data1.RecordSource = "select * from CDs where Title LIKE '" + Text1.Text + "'"

    No errors occur or anything, however it still requires me to type in the whole name ( and has to be exact) for it to work?

    any other ideas?

    Thanks

    Jenks

  4. #4
    Join Date
    Nov 2003
    Location
    Alameda, CA
    Posts
    1,737
    you forgot to append the * wildcard at the end of the name (actually, isn't that a %, at least in msql?)
    Marco
    "There are two ways to write error-free programs. Only the third one works."
    Unknown

  5. #5
    Join Date
    Apr 2005
    Posts
    53
    Thanks alot..it works fine now ....and btw it was * incase you were wondering..

    Thanks

    Jenks

  6. #6
    Join Date
    Apr 2006
    Posts
    6
    i have been looking for a way to search a MSFlexGrid column. but havent been able to find one. can i get any help on this matter?

  7. #7
    Join Date
    Apr 2006
    Posts
    47
    hi there

    Data1.RecordSource = "SELECT * FROM CDs WHERE Title LIKE '%" & Text1.Text & "%'"

    try this....i try this for my searching value......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center