Results 1 to 11 of 11

Thread: [RESOLVED] a little help in case sensitivity

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    51

    Resolved [RESOLVED] a little help in case sensitivity

    in my program, i have a textbox that specifies what data i will be searching in the database and diplaying it in the flexgrid... my problem is that it is case sensitive. How can i make the searching case insensitive? any ideas!?

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: a little help in case sensitivity

    What database are you using. I don't think case sensitivity is provided by default in any database. I guess you are missing something.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: a little help in case sensitivity

    Use either UCase or LCase whichever would be the most appropriate.

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    51

    Re: a little help in case sensitivity

    i'm using ms access 1997

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: a little help in case sensitivity

    It would probably be beneficial to know what is actually (in terms of case) being stored. All upper? All lower? Mixture? Provide an example.

  6. #6

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    51

    Re: a little help in case sensitivity

    o i c... it's a mixture in the database... So when I searched for the word "Wheels" it displays all columns with related to "Wheels" however "wheels" doesn't return anything at all

  7. #7
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: a little help in case sensitivity

    When you do a search, search for UCase("Wheels") and use the same for what is returned from the database,
    UCase(RSet.Fields("FieldName").Value)
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    51

    Re: a little help in case sensitivity

    thank you very much... but how do I use it in an SQL statement?...
    here is my code for searching

    Code:
    Data1.RecordSource _
    = "SELECT * FROM AERO " _
    & "Where Description = '" & Text1.Text & " '"

  9. #9
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: a little help in case sensitivity

    Well you would change Text1.Text to UCase(Text1.Text)
    and then I think you would so something like this;
    Code:
    Data1.RecordSource _
    = "SELECT * FROM AERO " _
    & "Where Description = '" & UCase(Text1.Text) & " '"
    
    UCase(Data1.RecordSource.Fields("FieldName").Value)
    I haven't tested this, and I'm not too sure, but give it a go
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  10. #10

    Thread Starter
    Member
    Join Date
    Feb 2008
    Posts
    51

    Re: a little help in case sensitivity

    well it didn't work but still thank you so much for the idea... guess I have no choice but to use a looping statement^^

  11. #11
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Re: [RESOLVED] a little help in case sensitivity

    If it helps, this is some code I have used for searching in the past and adding results to a listbox, using Access and ADO.
    You would just have to add the 'UCase' to it:
    Code:
    strSQL = "SELECT * FROM  tbl_Code"
    strSQL = strSQL & " WHERE 'N' & NodeID = '" & tmpCat & "'"
    strSQL = strSQL & " And (Code_Description LIKE '%" & strSearch & "%' OR Code_Text LIKE '%" & strSearch & "%')"
        
    
    End If
    rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly, adCmdText
        
    Do While Not rs.EOF
            With lstSearch
                .AddItem rs.Fields("Code_Description")
                ctr = ctr + 1
            End With
        rs.MoveNext
    Loop
    
    rs.Close
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

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