这段代码给我空数据库如何从DropDownList的数据插入到数据库的ASP C#
cmd2.Parameters.AddWithValue("@Fk_CatID", DropDownListCategory.SelectedItem.Value);
这个代码给我空数据库
string queryCategory = "select CatName from CategoryItemsTBL";
DataTable dtCategory = GetDataCategory(queryCategory);
DropDownListCategory.DataSource = dtCategory;
DropDownListCategory.DataTextField = "CatName";
DropDownListCategory.DataValueField = "CatName";
DropDownListCategory.DataBind();
显示您的完整代码。你在DropDownListCategory.SelectedItem.Value中得到什么 – DevelopmentIsMyPassion
没有更多的信息就无法说出你的代码有什么问题。在[如何问]上锁定(https://stackoverflow.com/help/how-to-ask)。 “DropDownListCategory.SelectedItem.Value”的值是什么? –
你有没有试过'DropDownListCategory.SelectedValue'? –