MasterPage.master
<div id="menu_search">
<span class="item_title">文章搜索</span>
<div id="menu_search_info" class="item_info">
<center>
<asp:TextBox ID="text_search" Width="156px" runat="server" MaxLength="20" />
<asp:Button ID="btn_search" Text="搜索" runat="server" UseSubmitBehavior="true" onclick="btn_search_Click" />
</center>
</div>
</div>
MasterPage.master.cs
protected void btn_search_Click(object sender, EventArgs e)
{
Response.Redirect("~/search.aspx?str_search_key_word=" + this.text_search.Text.ToString());
}
search.aspx.cs
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["db_kaoyanConnectionString"].ConnectionString);
SqlCommand cmd_english = new SqlCommand("select [id],[guid],[category],[title],[date] from article WHERE ([title] LIKE '%" + Request.QueryString["str_search_key_word"] + "%') ORDER BY [date] DESC", conn);
SqlDataAdapter da_english = new SqlDataAdapter(cmd_english);
DataSet ds_english = new DataSet();
摘自http://hi.baidu.com/%B4%F3%CE%B0/blog/item/754e6259029144202934f04f.html