日期:2014-05-17 浏览次数:20785 次
using (SqlConnection sqlconn = new SqlConnection(StrConn))
{
sqlconn.Open();
string Sql = "select ID,Name from Department";
SqlCommand Sqlcmd = new SqlCommand(Sql, sqlconn);
SqlDataAdapter Sda = new SqlDataAdapter(Sqlcmd);
DataSet Ds = new DataSet();
Sda.Fill(Ds, "Course");
this.comboBox1.DisplayMember = "Name";
this.comboBox1.ValueMember = "ID";
this.comboBox1.DataSource = Ds.Tables[0].DefaultView;
}