首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

数据库内容赋给comboBox解决方案

2013-08-13 
数据库内容赋给comboBoxstring FindMonth select PathMonth from hzPath where 检查编号 + txtID.Te

数据库内容赋给comboBox


string FindMonth = "select PathMonth from hzPath where 检查编号='" + txtID.Text + "'";
object readMonth = MySqlHelper.ExecuteScalar(MySqlHelper.Conn, CommandType.Text, FindMonth, null);
comboMonth.Items.Add(readMonth.ToString());



我将数据库的内容赋给了comboMonth,但是在数据库中PathMonth是有很多项的,我只将找到的第一个值赋给了comboMonth,要怎么改才能将PathMonth中所有内容都取出来赋给comboMonth呢?
[解决办法]
var -> DataRow 试试看。

热点排行