string sqlStr
= "select 需要获取的列明名 from 查询的表 where 进行筛选的列 ='" + 筛选内容
+ "'";
adapter
= new MySqlDataAdapter(sqlStr
, conn
);
dsCountry
= new DataSet();
adapter
.Fill(dsCountry
, "查询的表");
if (dsCountry
!= null && dsCountry
.Tables
.Count
>= 0 && dsCountry
.Tables
[0].Rows
.Count
> 0)
{
comboBox2
.Items
.Clear();
for (int i
= 0; i
< dsCountry
.Tables
[0].Rows
.Count
; i
++)
{
comboBox2
.Items
.Add(dsCountry
.Tables
[0].Rows
[i
]["需要获取的列名"].ToString());
}
}
劳烦点个赞,添加个关注
转载请注明原文地址:https://blackberry.8miu.com/read-5646.html