A search query using VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cheeese
    New Member
    • Jan 2007
    • 5

    A search query using VB

    Hello All,
    I need to search a particular keyword in a SQL database using VB6. I found that the asterix (*) does not work for the query and the record list obtained is empty. Here is the query I entered,

    Sql = "Select table.name,tabl e.number from table where (((table.name) Like '*Eng*')) ;"

    Set Rs = Con.Execute(Sql )

    When con and rs are the connection and record set respectively.

    The query works fine without the * symbol , but I only get an exact match. I need to find all entries which contain words beginning with the keyword. Please help.
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Originally posted by Cheeese
    Hello All,
    I need to search a particular keyword in a SQL database using VB6. I found that the asterix (*) does not work for the query and the record list obtained is empty. Here is the query I entered,

    Sql = "Select table.name,tabl e.number from table where (((table.name) Like '*Eng*')) ;"

    Set Rs = Con.Execute(Sql )

    When con and rs are the connection and record set respectively.

    The query works fine without the * symbol , but I only get an exact match. I need to find all entries which contain words beginning with the keyword. Please help.

    Use this qry
    =============== ========= Qry =============== =======
    Sql = "Select table.name,tabl e.number from table where (((table.name) Like '%Eng%')) ;"

    Set Rs = Con.Execute(Sql )

    Comment

    • Cheeese
      New Member
      • Jan 2007
      • 5

      #3
      Thank you very much. The query worked!

      Comment

      Working...