CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Guest

    How to use 'Like' in a query..........

    I am using 'Like' in a sql query for a text field but not able get that to work. Here is what I am doing

    SDescription = "'" & Text1.Text & " *'"

    "SELECT * FROM TABLE WHERE DESCRIPTION LIKE " & SDescription



  2. #2
    Join Date
    Sep 1999
    Location
    Leeds U.K. (Proud to be Sheffield Born)
    Posts
    202

    Re: How to use 'Like' in a query..........

    What Database Format are you using?


  3. #3
    Guest

    Re: How to use 'Like' in a query..........

    Access 97 and ADO. Does that matter?


  4. #4
    Join Date
    Feb 2000
    Location
    Ireland
    Posts
    808

    Re: How to use 'Like' in a query..........

    The best way to do it is

    SELECT * FROM TABLE WHERE DESCRIPTION LIKE '*" & text1.text & "'"



    As far as I remember the wildcard for access is "*" if not use "%" which is the one for SQL Server
    Don't forget that it will only work on words of the same case





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

Featured