日期:2014-05-17  浏览次数:21256 次

数据库内容赋给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 试试看。