标签:sele from database 隐藏 str name 适配器 字符 ada
string str = "server=.;database=数据库名称;uid=sa;pwd=123";
SqlConnection sqlcon = new SqlConnection(str);
```C#
### 3、sql语句
```C#
string sql = "select classId,className from dbo.Class";
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sql,sqlcon);
da.Fill(ds);
this.comboBox1.DataSource = ds.Tables[0];
this.comboBox1.ValueMember = "classId";//隐藏列
this.comboBox1.DisplayMember = "className";//显示列
标签:sele from database 隐藏 str name 适配器 字符 ada
原文地址:https://www.cnblogs.com/Alax-LJJ/p/14660877.html