Advanced Select Query

Discussion in 'ASP .Net' started by Aaron, Jan 5, 2004.

  1. Aaron

    Aaron Guest

    I need a query that can return wildcard matches if there's no exact
    match. There's how the process works.

    1. Input = "my email address is "
    2. Look for exact match.
    3. Look for wildcard match.
    4. Found = "my * address *"
    5. output = "my * address *"

    I hope this makes sense,
    Thanks in advance
    Aaron
    Aaron, Jan 5, 2004
    #1
    1. Advertising

  2. Aaron

    Joey Powell Guest

    Aaron, use a SqlDataReader or an OleDbDataReader to query your
    database for an exact match - at first use "SELECT [FieldName] FROM
    [TableName] WHERE [FieldName]='[SearchCriteria]'".

    The results from the .ExecuteReader method will return the total
    number of rows affected by the query. If that equals zero (which would
    indicate no exact match) then modify the select statement to include
    the SQL LIKE keyword and then execute the reader again - "SELECT
    [FieldName] FROM [TableName] WHERE [FieldName] LIKE
    '[SearchCriteria]'". If it still returns zero then no match would
    exist, period.

    This process would return and exact or approximate match. HTH JP

    (Aaron) wrote in message news:<>...
    > I need a query that can return wildcard matches if there's no exact
    > match. There's how the process works.
    >
    > 1. Input = "my email address is "
    > 2. Look for exact match.
    > 3. Look for wildcard match.
    > 4. Found = "my * address *"
    > 5. output = "my * address *"
    >
    > I hope this makes sense,
    > Thanks in advance
    > Aaron
    Joey Powell, Jan 6, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aaron
    Replies:
    1
    Views:
    863
    Munsifali Rashid
    Jan 6, 2004
  2. DocBadwrench
    Replies:
    0
    Views:
    1,975
    DocBadwrench
    Oct 12, 2006
  3. Replies:
    5
    Views:
    279
    scottishguy
    Aug 8, 2007
  4. Michele Simionato
    Replies:
    1
    Views:
    579
    Lacrima
    Mar 27, 2010
  5. palmiere
    Replies:
    1
    Views:
    331
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page