朋友们,我已经正确地将下拉列表与数据集绑定,但它给出了这个错误:我的代码是:
绑定数据集
DataSet ds = new ViewAction().GetAllProductInfoData();
ddlprdctname.DataSource = ds;
ddlprdctname.DataTextField = "ProductName";
ddlprdctname.DataValueField ="ProductID";
ddlprdctname.DataBind();
和 GetAllProductInfoData() 函数是
public DataSet GetAllProductInfoData()
{
SqlCommand cmd = DataConnection.GetConnection().CreateCommand();
cmd.CommandText = "Select ProductID ProductName,SubCategory2ID,CompanyID,Price,Quantity,Description from ProductInfo";
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
cmd.Dispose();
DataConnection.CloseConnection();
return ds;
}
什么是错误请帮我解决