如何使下拉列表C#? [英] how to make drop down list c#?

查看:108
本文介绍了如何使下拉列表C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用combobox从数据库中读取数据作为下拉列表?
示例
大家好,您如何需要u
的帮助? 1.如何按字母顺序获取组合框中的数据?我正在使用c#2008和sq l服务器2005
例如:
我的kk数据库中有一些数据,其表名gg具有列名
user_name和user_id
user_id包含数据:
阿贝贝
查拉
贝基
dd
阿莱姆
bako
很快我需要将此数据显示在我的组合框中,就像这样
当开始在组合框中键入"A"时,它必须像这样从"a"开始提取数据
阿贝贝
阿莱姆


2.请通过显示如何使用带有sql数据库的c#类动态连接数据库来帮助我.强烈要求任何好的免费参考资料
谢谢您的帮助
请告诉我所有必要的步骤
回复Quote

how can i read data from data base as a drop down list using combobox?
Example
hi every body how are you need a help from u
1. how can i fetch data in my combo box alphabetically? I''m using c#2008 and sq l server 2005
example:
there are data in my kk data base with a table name gg having column name
user_name and user_id
user_id has data:
abebe
chala
beki
dd
alem
bako
and soon i need this data to be displayed in my combo box liken this
when start to type ''A'' in my combo box it must fetch data beginning with ''a'' like this
abebe
alem


2. please help me by showing how to connect data base dynamically using c# classes with sq l database. any good and free reference is highly required
thank u for u''r help
please show me all the necessary steps for the question
Reply With Quote

推荐答案

第1部分
通过C#访问SQL Server的入门指南 [
Part 1
Beginners guide to accessing SQL Server through C#[^]

Part 2

DropDownList.DataSource = the data table
DropDownList.DataValueField = the field you want
DropDownlist.DataBind();


1.您不需要为此使用ComboBox.您只需要一个具有AutoComplete属性集的TextBox.查看MSDN了解如何完成.

2. MSDN怎么样?
1. You do not need a ComboBox for this. All you need is a TextBox with AutoComplete property set. Look into MSDN to understand how it can be done.

2. How about MSDN?


这篇关于如何使下拉列表C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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