You must Sign In to post a response.
  • Category: ASP.NET

    Sql Parameter Like in where clause

    SELECT [Field1],[Field2],[Field3],[Field4] FROM [dbo].[TableName] WHERE [Field1] like '%'+@Field1Par+'%' ORDER BY Field1 DESC

    db.AddParameter("@Field1Par", SqlDbType.VarChar, tbName.Text);

    here my problem is...

    i want to search with the initial characters..

    i mean .. WHERE [Field1] like '%'+@Field1Par ORDER BY Field1 DESC.

    any help...
  • #476081
    What you meant by "i want to search with the initial characters.. "

    SQL query will execute with the value you are passing.

    Are you looking for AutoComplete feature like when user enters "A" then all name should list which start with "A".

    Please explain it properly..

    Asheej T K

  • #476084
    Yes Mr. Asheej...

    i am looking for autocomplete option.

  • #476126
    You can use YUI or other autocomplet tools. Its easy and free one..
    You need to select all the fields only. dont need anything to do in Yahoo Util Interfase(YUI)

    By Nathan
    Direction is important than speed

  • #476138
    thanks for both Asheej T K & Shunmuganathan M.

    i got it.

    thanks Again.

  • #476256

    select firstname from empregistration where firstname like 's'+'%'


  • #476358
    sSqlQuery = "IF EXISTS(SELECT DomainID FROM Domains "
    + "WHERE URL LIKE '%'+ @URL +'%' AND DomainID<>@DomainID AND Status=1) "
    + "SELECT 1 "
    + "ELSE SELECT 0";

  • #476416
    thanks guys :)

  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.