我有兩個頁面,一個search.aspx和show.aspx在search.aspx顯示搜索數據時,搜索按鈕點擊
我有2個文本框,位置,標題1個下拉列表,經驗
現在,當人點擊搜索按鈕,如果人已經比GridView控件顯示填充的位置該位置的所有數據,如果人填補這兩個位置,標題比它應該顯示的位置和標題的這兩個條件的數據,如果人補全文本框,下拉列表比它應該顯示與該位置的標題和經驗
數據現在,因爲我有GridView控件在另一頁,所以我所有的文本框,下拉值轉移到另一個頁面通過查詢字符串,但它沒有顯示任何數據
和搜索另一個這樣應該怎樣存儲過程?
我做了類似
存儲程序 - (錯了,但它實際上應該是什麼?)
ALTER PROCEDURE search
(
@Location nvarchar(50),
@Experience nvarchar(50),
@Title nvarchar(50)
)
AS
select * from Jobs where
[email protected] and
[email protected] and
[email protected]
or
[email protected]
or
[email protected]
or
[email protected]
search.aspx-
protected void imgbtnsubmit_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("show.aspx?loc,title,exp="+textloc.text+txttitle.Text+dropdownlistexperience.SelectedItem);
}
在show.aspx頁
,它這需要在查詢字符串該值並顯示在grdview
show.as perticular數據PX-
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
dal.location = Request.QueryString["loc"];
dal.title = Request.QueryString["title"];
dal.exerience = Request.QueryString["exp"];
GridView1.DataSource = bal.search(dal);
GridView1.DataBind();
}
}
bal-
public DataTable search(portalDal dal)
{
con.Open();
cmd = new SqlCommand("search", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Location", dal.location);
cmd.Parameters.AddWithValue("@Experience", dal.experience);
cmd.Parameters.AddWithValue("@Title", dal.title);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
con.Close();
return dt;
}
錯誤 - 過程或函數 '搜索' 預計參數 '@location',但未提供。
我覺得..in搜索頁 –
你沒有錯保護無效imgbtnsubmit_Click(對象發件人,ImageClickEventArgs E) { 的Response.Redirect( 「?show.aspx LOC,標題,EXP =」 + textloc.text + txttitle.Text + dropdownlistexperience.SelectedItem); }看到的差異textloc.text + txttitle.Text textloc.text是小寫,它應該是txtloc.Text –