checkedlistbox多选清空数据库表 (在线等) checkedlistbox 的 items 是表1 表2 表3 数据库里面表是 T1 T2 T3怎么在 button1_Click 下实现选中那几个表就 delete from 表 选择的那几个表请高手指点 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 换吧,用dataGridView很好实现,这个应该不能,没地方藏ID 你从CheckedListBox中选择了某些checkbox,记录下其text属性,再从数据库中,根据text查询那三个对应的表,删之,即可。 string str = ""; foreach (object checkedItem in checkedListBox1.CheckedItems) { str+=checkedItem.ToString()+","; } string[] aryOptions = str.Split(','); string s1 = aryOptions[0].ToString(); string s2 = aryOptions[1].ToString(); string s3 = aryOptions[2].ToString();在对 s1 s2 s3操作 我写个演示代码给你参考一下,让你有个直观的感受(由于时间紧,以下代码未经测试,并且大小写也不标准)://从checkedListBox中获取选中的checkbox的text属性:string s="";for(checkbox chb in checkboxlist.items){ if(chb.checked) s+=chb.Text+",";}string[] textArray=s.split(',');//接下来对数据库操作,找到指定的表,并删之for(int i=0;i<textArray.length;i++){ select from database where table.name=textArray[i].tostring();} 100分:怪异的ORA-12154 问一下winform自动回复的问题 在VS中如何绑定快捷键,并实现自己写的功能,比如空格键。(窗体上默认是文本框获得焦点) C#怎么把存如到SQL中的视频二进制流取出来并显示出来?高手进~~~~~[痴迷.NET]~~~~~~ 帮我看看代码那里有问题 dropDownlist如何添加年从.比如1910到2006 请教加密问题 菜单上添加图片 或小图标 请教一个DIV标记的问题好吗?谢谢!! crystalreport 的集成认证如何与NT(2K)SERVER集成?? 单件模式的线程问题 软件项目开发计划书 在线等 顶着有分
foreach (object checkedItem in checkedListBox1.CheckedItems)
{
str+=checkedItem.ToString()+",";
}
string[] aryOptions = str.Split(',');
string s1 = aryOptions[0].ToString();
string s2 = aryOptions[1].ToString();
string s3 = aryOptions[2].ToString();
在对 s1 s2 s3操作
//从checkedListBox中获取选中的checkbox的text属性:
string s="";
for(checkbox chb in checkboxlist.items)
{
if(chb.checked) s+=chb.Text+",";
}string[] textArray=s.split(',');//接下来对数据库操作,找到指定的表,并删之
for(int i=0;i<textArray.length;i++)
{
select from database where table.name=textArray[i].tostring();
}