我做了從數據庫中填充它的值的下拉列表 但是當它運行它不會得到第一排並獲得其他人,如果我添加新它得到它 是什麼問題?dropdownlist預計第一排
private void LoadWithCategory()
{
if (Request.QueryString["Category_Id"] != null)
{
using (SqlConnection Con = Connection.GetConnection())
{
SqlCommand Com = new SqlCommand("GetProducFamilyTP", Con);
Com.CommandType = CommandType.StoredProcedure;
Com.Parameters.Add(
Parameter.NewInt("@Category_Id", Request.QueryString["Category_Id"]));
SqlDataReader DR = Com.ExecuteReader();
if (DR.Read())
{
DDLProductFamily.DataSource = DR;
DDLProductFamily.DataTextField = "Name";
DDLProductFamily.DataValueField = "ProductCategory_Id";
DDLProductFamily.DataBind();
}
else
{
DDLProductFamily.Visible = false;
}
}
}
}
你能後的代碼填充這個下拉?沒有它就不可能說出來。 – 2010-04-18 11:59:57
看到我的問題,我通過查詢字符串 有我的代碼 – Myworld 2010-04-18 13:16:54