1
我有soulation。我想使導航欄中的項目,我會選擇他們作爲(類別,產品,....)所以我做了存儲,讓他們通過參數將通過它,s值從查詢字符串爲 as。導航欄從數據庫
ALTER Proc Navcategory
(
@Category_Id Int
)
As
Select Distinct Categories.Category,Categories.Category_Id
From Categories
Where [email protected]_Id
和i的CS 提到
if (Request.QueryString["Category_Id"] != null)
{
Banar.ImageUrl = "Handlers/Banner.ashx?Category_Id=" + Request.QueryString["Category_Id"] + "";
using
(SqlConnection conn = Connection.GetConnection())
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "Navcategory";
cmd.Parameters.Add(Parameter.NewInt("@Category_Id", Request.QueryString["Category_Id"]));
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
LblNavigaton.Visible = true;
LblNavigaton.Text = dr["Category"].ToString();
}
}
}
所以結果將是離。 冰箱>(分類querstring(CATEGORY_ID)時)(查詢字符串時,產品展示(產品)) 4Door>
但我想要的結果 冰箱> 4Door> ...> ....
我建議你嘗試重新排列你的問題,這樣人們可以更容易地閱讀。 – 2010-04-07 13:26:17