本文整理汇总了C#中DBHelper.dbSearch方法的典型用法代码示例。如果您正苦于以下问题:C# DBHelper.dbSearch方法的具体用法?C# DBHelper.dbSearch怎么用?C# DBHelper.dbSearch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBHelper
的用法示例。
在下文中一共展示了DBHelper.dbSearch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: searchbutton_Click
private void searchbutton_Click(object sender, EventArgs e)
{
String searchParam = searchCombo.SelectedItem.ToString();
String boxString = SearchBox.Text;
String dbString = null;
DBHelper db = new DBHelper();
if (searchpatronradio.Checked)
{
switch (searchParam)
{
case "Patron ID": dbString = "Select * from patron where patron_ID LIKE '%" + boxString + "%' AND NOT Inactive;";
break;
case "First Name": dbString = "Select * from patron where First_Name LIKE '%" + boxString + "%' AND NOT Inactive;";
break;
case "Last Name": dbString = "Select * from patron where Last_Name LIKE '%" + boxString + "%' AND NOT Inactive;";
break;
case "Phone": dbString = "Select * from patron where Telephone LIKE '%" + boxString + "%' AND NOT Inactive;";
break;
case "Email": dbString = "Select * from patron where Email LIKE '%" + boxString + "%' AND NOT Inactive;";
break;
}
}
if (searchbookradio.Checked)
{
switch (searchParam)
{
case "Title": dbString = "Select * from books where Title LIKE '%" + boxString + "%';"; break;
case "Author First": dbString = "Select * from books where Author_Firstname LIKE '%" + boxString + "%';"; break;
case "Author Last": dbString = "Select * from books where Author_Lastname LIKE '%" + boxString + "%';"; break;
case "ISBN": dbString = "Select * from books where ISBN LIKE '%" + boxString + "%';"; break;
case "Shelf": dbString = "Select * from books where Shelf_ID LIKE '%" + boxString + "%';"; break;
}
}
db.dbSearch(dbString, searchResults);
}