.net中的组合框 [英] combobox in .net

查看:93
本文介绍了.net中的组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我有一个名为Student的表,其列为Rollno,Name,FatherName.
一种形式包含comboBox.我必须将总计RollNos添加到该组合框.
帮帮我...

hai everybody,
i have one table named Student with columns Rollno,Name,FatherName .
one form contain comboBox . i have to add total RollNos to that combobox .
help me...

推荐答案

可能是您在问这个问题

may be you are asking this

SqlConnection con = new SqlConnection("<connectionstring>");
SqlDataAdapter ad;
DataTable dt = new DataTable();
ad = new SqlDataAdapter("select Rollno from Student",con);
ad.Fill(dt);
comboBox1.DataSource=dt;
comboBox1.DisplayMember="Rollno";//column name of DataBase Table
comboBox1.ValueMember="Rollno";//column name of Database Table


</connectionstring>


这篇关于.net中的组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆