passing wildcard criteria - Inetserver

This is a discussion on passing wildcard criteria - Inetserver ; Hi, I'm having a little trouble using the SQL LIKE clause with asp.net to an Access Database... Dim strSQL as String = "SELECT * FROM tblDickerExtensions WHERE Surname " & " LIKE " & criteria & "*" I just can't ...

+ Reply to Thread
Results 1 to 4 of 4

passing wildcard criteria

  1. Default passing wildcard criteria

    Hi,
    I'm having a little trouble using the SQL LIKE clause with asp.net to an
    Access Database...

    Dim strSQL as String = "SELECT * FROM tblDickerExtensions WHERE Surname
    " & " LIKE " & criteria & "*"

    I just can't get the " & ' syntax correct, I'm sure it's a 2 second
    thing for you guys...

    thanks in advance for help

  2. Default Re: passing wildcard criteria

    Wendy Parry wrote on 12 feb 2006 in microsoft.public.inetserver.asp.db:

    > Hi,
    > I'm having a little trouble using the SQL LIKE clause with asp.net to an
    > Access Database...
    >
    > Dim strSQL as String = "SELECT * FROM tblDickerExtensions WHERE Surname
    > " & " LIKE " & criteria & "*"


    "as String"
    not in asp-vbs

    " & criteria & "*"
    must be quoted

    Dim strSQL,criteria
    criterium = "bl?h*"
    strSQL = "SELECT * FROM tblX WHERE Sn LIKE '" & criterium & "'"



    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

  3. Default Re: passing wildcard criteria


    "Wendy Parry" <wendy.parry@lotusblossom.org.uk> wrote in message
    news:dsn8cn$dlu$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
    > Hi,
    > I'm having a little trouble using the SQL LIKE clause with asp.net to an
    > Access Database...
    >
    > Dim strSQL as String = "SELECT * FROM tblDickerExtensions WHERE Surname "
    > & " LIKE " & criteria & "*"
    >
    > I just can't get the " & ' syntax correct, I'm sure it's a 2 second thing
    > for you guys...
    >
    > thanks in advance for help


    Try changing it to

    Dim strSQL as string = "SELECT * FROM tblDickerExtensions WHERE Surname LIKE
    '%" & criteria & "%'"

    Note the single quote ' before and after the %

    Don't know if this will work in asp.net but it works with classic asp

    Roger



  4. Default Re: passing wildcard criteria

    Roger Hembury wrote:
    > "Wendy Parry" <wendy.parry@lotusblossom.org.uk> wrote in message
    > news:dsn8cn$dlu$1@nwrdmz01.dmz.ncs.ea.ibs-infra.bt.com...
    >
    >>Hi,
    >>I'm having a little trouble using the SQL LIKE clause with asp.net to an
    >>Access Database...
    >>
    >>Dim strSQL as String = "SELECT * FROM tblDickerExtensions WHERE Surname "
    >>& " LIKE " & criteria & "*"
    >>
    >>I just can't get the " & ' syntax correct, I'm sure it's a 2 second thing
    >>for you guys...
    >>
    >>thanks in advance for help

    >
    >
    > Try changing it to
    >
    > Dim strSQL as string = "SELECT * FROM tblDickerExtensions WHERE Surname LIKE
    > '%" & criteria & "%'"
    >
    > Note the single quote ' before and after the %
    >
    > Don't know if this will work in asp.net but it works with classic asp
    >
    > Roger
    >
    >

    Thanks Roger, that worked a treat...

+ Reply to Thread

Similar Threads

  1. Opening new form with certain criteria and passing data.
    By Application Development in forum ADO DAO RDO RDS
    Replies: 0
    Last Post: 08-30-2007, 03:51 PM
  2. Replies: 0
    Last Post: 03-28-2007, 08:01 AM
  3. wildcard '%' acting like wildcard '_' in .net aspx page
    By Application Development in forum ADO DAO RDO RDS
    Replies: 0
    Last Post: 03-27-2007, 02:51 PM
  4. wildcard searching?
    By Application Development in forum Adobe Acrobat
    Replies: 0
    Last Post: 12-14-2006, 06:37 AM
  5. Wildcard Searching
    By Application Development in forum Inetserver
    Replies: 2
    Last Post: 04-30-2004, 03:49 AM