我有一個asp頁面和一個搜索按鈕上的2個文本框。用戶可以通過在任何搜索框中輸入文字進行搜索。我正在使用gridview項目temblate並綁定數據集。請告訴我如何通過文本框來搜索數據。例如:用戶可以通過在所有2個文本框或3個文本框中輸入數據進行搜索。請提供我要asp.net C#通過多個文本框或在asp.net中gridview一個接一個查找數據c#
protected void SearchButton_Click(object sender, EventArgs e)
{
string str = "Select [ITEM No#], [Company Name], [Discipline Required], [Service Description], Institution, [Award Date] from PSP_Report where ([ITEM NO#] like '%' + @search + '%' [Company Name] like '%' + @search1 + '%')";
SqlCommand xp = new SqlCommand(str, con);
xp.Parameters.Add("@search", SqlDbType.NVarChar).Value = RefNo.Text;
xp.Parameters.Add("@search1", SqlDbType.NVarChar).Value = RefNo.Text;
con.Open();
xp.ExecuteNonQuery();
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = xp;
DataSet ds = new DataSet();
da.Fill(ds, "ITEM No#");
Search.DataSource = ds;
Search.DataBind();
con.Close();
}
的Id我有一個asp頁面上兩個文本框和一個搜索按鈕。用戶可以通過在任何搜索框中輸入文字進行搜索。我正在使用gridview項目temblate並綁定數據集。請告訴我如何通過文本框來搜索數據。例如:用戶可以通過在所有2個文本框或3個文本框中輸入數據進行搜索。請爲我提供asp.net c#的任何代碼或建議。 –