先提取出数据库中的数据
SqlConnection conn = new SqlConnection();
conn.ConnectionString = cString;
conn.Open();
SqlCommand cmd=new SqlCommand(sql,conn);
SqlDataAdapter MySDA = new SqlDataAdapter();
DataSet MyDS = new DataSet();
MySDA.SelectCommand = cmd;
MySDA.Fill(MyDS);
然后再添加到comboBox中
this.cobIdentity.Items.Clear();
int i=0;
for (i=0;i<MyDS.Tables[0].Rows.Count;i++)
{
//加载用户组身份
this.cobIdentity.Items.Add(MyDS.Tables[0].Rows[i][1].ToString());
} // End For
this.cobIdentity.Text="--请选择--";