locked
Search Like in Excel RRS feed

  • Question

  •  

     

    I want to search  Text  Like In Excel  Program 

    if i ant to search  about  khaleel  ahmed zourob 

    and i want to search about all data in tables like  this  khaleel * zourob

    he found result like this  khaleel ahmed zourob

    khaleel   adel zourob

    and more  more

     

    how  to make this  in sql server   and vb.net 

    select * from employee where Name LIKE '%" & TxtSearch.Text & "%'"
    

    Wednesday, March 9, 2011 7:52 AM

Answers

  • Hi KhaLeeL,

     

    Welcome to the MSDN Forum. This is Rocky and I will do my best to help you.

     

    We can make this in SQL Server by using the following code:

                    select * from userName where Id like '%string%'

     

    We can make this in VB.NET by using the following code:

                    Dim str1 As String = "select * from orders where OrderID like " & " '%" & TextBox1.Text.ToString() & "%' "

    It works well on my  machine.

    I hope this will help resolve your problem. If anything is unclear, please free feel to let us know.

    Best Regards,


    Rocky Yue[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Calvin_Gao Friday, March 11, 2011 8:31 AM
    • Marked as answer by Calvin_Gao Tuesday, March 15, 2011 10:43 AM
    Friday, March 11, 2011 8:23 AM

All replies

  • First you have to create the correct SQL Transact code, which has for the LIKE slight differences for Access and SQL about the wild card characters (I always forget what is what in this).

    You can first try the SQL transact forum where you get probably the best first help for your qeustion.

    If you have that transact code than helping you with VB is easy.

    http://social.msdn.microsoft.com/Forums/en-US/transactsql/threads


    Success
    Cor
    Wednesday, March 9, 2011 7:58 AM
  • Hi KhaLeeL,

     

    Welcome to the MSDN Forum. This is Rocky and I will do my best to help you.

     

    We can make this in SQL Server by using the following code:

                    select * from userName where Id like '%string%'

     

    We can make this in VB.NET by using the following code:

                    Dim str1 As String = "select * from orders where OrderID like " & " '%" & TextBox1.Text.ToString() & "%' "

    It works well on my  machine.

    I hope this will help resolve your problem. If anything is unclear, please free feel to let us know.

    Best Regards,


    Rocky Yue[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Calvin_Gao Friday, March 11, 2011 8:31 AM
    • Marked as answer by Calvin_Gao Tuesday, March 15, 2011 10:43 AM
    Friday, March 11, 2011 8:23 AM