locked
Help Query Question??? RRS feed

  • Question

  • User-1269234728 posted

    Hi Guys,

         I have this Query which works, but would likw to augment it with  LIKE '%'  So that it will Search by AutoName and/Or Model

    But I'm not quite sure how to write this??? Can someone help... Thanks

    Here's what I have so far:

    Query = String.Format("SELECT {0} FROM {1} WHERE AutoName = '{2}' AND Model = '{3}' OR AutoName = '{4}' ORDER BY {5}", PrimaryKeyColumn, TableName, DDLCategory.SelectedItem.Text, DDLSubCategory.SelectedItem.Text, txtSearch.Text, SetSorting())

    Saturday, December 10, 2011 3:33 AM

Answers

  • User1839833660 posted

    Query = String.Format("SELECT {0} FROM {1} WHERE AutoName like '{2}%' AND Model like '{3}%' OR AutoName like '{4}%' ORDER BY {5}", PrimaryKeyColumn, TableName, DDLCategory.SelectedItem.Text, DDLSubCategory.SelectedItem.Text, txtSearch.Text, SetSorting())

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, December 10, 2011 3:57 AM