C#的DropDownList有关问题
C#的DropDownList问题我SQL有1个商品表,商品类型为A,商品ID为1.我是动态绑定数据库的,我要怎么写代码才能
C#的DropDownList问题
我SQL有1个商品表,商品类型为A,商品ID为1.
我是动态绑定数据库的,我要怎么写代码才能
让我的下拉菜单里面显示的样式是 ID:类型 {1:A}?
请教各位大神!!!! c# sql
[解决办法]
现将数据表记录填充到DataTable里
然后绑定DropDownList
dropDownList1.DataSource=datable1;
dropDownList1.DisplayMember="商品类型";
dropDownList1.ValueMember="ID";
dropDownList1.DataBind();
[解决办法]
select (convert(nvarchar,ID)+':'+ProductBigType) as content from table
[解决办法]恩,你的是ID的话还是用varchar好
select (convert(varchar,ID)+':'+ProductBigType) as content from table
[解决办法]content 错误应该是下面 你用选中的数据 对数据库错做了吧
[解决办法]...
那你就多查一个字段。。
select (convert(varchar,ProductTypeNo)+':'+ProductTypeName) as content,ProductTypeNo from ProductTypeMaster where ProductType='1'