Results 1 to 5 of 5

Thread: sql and wildcards

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Posts
    98

    sql and wildcards

    I want to build a sql string from a form. I have four dropdown boxes, if there is a selection in a box it gets put in the sql string.
    Problem is if there is no selection then my string doesn't work.
    to keep it simple lets stick to two pulldowns

    Ex.
    sql="select * from product where Foundby =" & PullDown1 & Product=" & PullDown2

    If PullDown2 has no selection it should be a wildcard but the * doesn't seem to work.

    Without building a bunch of if statements with different sql strings is there an approach I can take to still retrieve all data regardless of whether PullDown1 or PullDown2 has a entry.

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    sql uses % isntead of *
    and _ isntead of ?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    you also have to use like

    Where field like '%ello'
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4
    Addicted Member kidlaley's Avatar
    Join Date
    Jun 2002
    Location
    California
    Posts
    159

    What Cander said!!!!

    sql uses % isntead of *
    and _ isntead of ?

    you also have to use like
    Where field like '%ello'

    Cander Beat Me to it!!!
    There's only Three kinds of people in this world.....
    Those that know how to count, and those that do not......
    ]

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 2002
    Posts
    98

    Thanks!!!

    Worked like a charm!

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