我有下拉列表,我想通過存儲過程 填充數據從數據庫,它具有它,s值當特定查詢字符串我有兩個查詢字符串。查詢字符串填充下拉列表
作爲
私人無效LoadWithCategory() { 如果(的Request.QueryString [ 「CATEGORY_ID」]!= NULL){ 使用 (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 = DR["Name"].ToString();
DDLProductFamily.DataValueField = DR["ProductCategory_Id"].ToString();
DDLProductFamily.DataBind();
}
DR.Close();
}
}
}
ALTER PROC GetProducFamilyTP ( @Category_Id詮釋 ) AS SELECT DISTINCT Categories.Category_Id,ProductCategory.Name, ProductCategory.ProductCategory_Id 從Category_ProductCategory
內加入分類 在 Category_ProductCategory.Category_Id = Categories.Category_Id 內部聯接產品分類 在 Category_ProductCategory.ProductCategory_Id = ProductCategory.ProductCategory_Id Where Categories.Indd = @ Category_Id
但發生此錯誤
DataBinding:'System.Data.Common.DataRecordInternal'不包含名稱爲'4Door'的屬性。
重複? http://stackoverflow.com/questions/2645639/fill-dropdown-list-by-querystring – 2010-04-18 09:20:17
但錯誤我無法解決它,我提到了它 – Myworld 2010-04-18 11:02:40
檢查你的程序和你的表 - 錯誤說清楚,無法找到'4門' – Aristos 2010-04-18 14:00:18