C# ComboBox控件 如何把数据库的信息加入到ComboBox控件中

C# ComboBox控件 如何把数据库的信息加入到ComboBox控件中,第1张

可以用一个SqlDataReader 将数据库的信息加入到ComboBox控件中:

SqlDataReader read=new SqlDataReader("select id from user")

if(read.hasrows)

{

while(read.Read())

commobox.items.add(read["id"].tostring())

}

可以用一个SqlDataReader 将数据库的信息加入到ComboBox控件中:

SqlDataReader read=new SqlDataReader("select id from user")

if(read.hasrows)

{

while(read.Read())

commobox.items.add(read["id"].tostring())

}


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/10028683.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-04
下一篇2023-05-04

发表评论

登录后才能评论

评论列表(0条)

    保存