读书人

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

发布时间: 2013-08-13 16:43:28 作者: rapoo

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

读书人网 >C#

热点推荐