C#:如何将SQL的数据显示在comboBox

SqlConnection Conn=....
//初始化,comboBox1绑定客户表
string Sql= "select customerName from customer";
DataSet Ds= new DataSet();
SqlDataAdapter Da= new SqlDataAdapter(Sql, Conn);
Da.Fill(Ds, "customer");
comboBox1.DataSource = Ds.Tables["customer"];
comboBox1.DisplayMember = "customerName";

 

来自:http://www.cnblogs.com/52yixin/articles/1822433.html

posted @ 2013-01-07 15:40  混蛋程序员  阅读(495)  评论(0编辑  收藏  举报