将选定的下拉列值放入列表框(多个值),然后将这些值插入到具有相同ID的数据库中 [英] selected dropdown value into the list box(multiple values) and then insert those into database with the same id

查看:55
本文介绍了将选定的下拉列值放入列表框(多个值),然后将这些值插入到具有相同ID的数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


请有人帮助

1 下拉列表 1 listbox 1 插入按钮。

下拉列表将包含所有选项 如果 用户选择一个点击插入按钮,它将插入 列表框, if user 插入另一个项目,它将再次插入列表框中。



然后让我们说列表框现在包含所有 所选项目 by 用户



如果 保存按钮被点击它将所有 保存 数据库 名称 已插入

解决方案

var ddl = this.DropDownList1.Items.Cast>();

var lst = this.lstid.Items.Cast>();

if(ddl.ToArray ().Intersect(lst.ToArray())。Count()== ddl.Count())

{

//插入数据库

}

其他

{

//请检查复制intem isnsertion

//插入到listBox

}

Hi,
Please can anyone help

there is 1 dropdown list and 1 listbox and 1 insert button.

dropdownlist will contain all the choices and if user choose one and hit the insert button it will be inserted in the listbox, and if user would like to insert another item it will be inserted again in the listbox.



and then lets say that the listbox now contain all of the items chosen by the user.



if save button was clicked it will all be save in the database with the column name "Inserted".

解决方案

var ddl = this.DropDownList1.Items.Cast>();
var lst = this.lstid.Items.Cast>();
if (ddl.ToArray().Intersect(lst.ToArray()).Count() == ddl.Count())
{
//insert to database
}
else
{
//Please check duplicate intem isnsertion
//insert to listBox
}


这篇关于将选定的下拉列值放入列表框(多个值),然后将这些值插入到具有相同ID的数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆