如何在文本框textchanged事件上从数据库填充列表框? [英] How to populate listbox from database on textbox textchanged event?

查看:86
本文介绍了如何在文本框textchanged事件上从数据库填充列表框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在文本框textchanged事件中从数据库填充列表框并选择将值存储到数据库中.

示例:


我有一张桌子 tblAccount
字段是:
appAccountID
appAccountName
appParentID
appCreatedDate

我想要这种类型的输出:
appAccountID appAccountName appParentID appCreatedDate
1主页0 2012年7月28日
2办公室0 28-07-2012
3薪水2 2012年7月29日
4蔬菜1 2012年7月29日

当我想将家庭费用添加到 home accountName中时,我在写完主页后在txtSearchAccount中写下来,它将显示主页的所有子类别
当我选择home时,它将存储appParentID = home的主键.
请帮帮我.

预先谢谢您.

How to populate listbox from database on textbox textchanged event and select value store into database .

Example:


I have one table tblAccount
Fields are:
appAccountID
appAccountName
appParentID
appCreatedDate

I want this type of output:
appAccountID appAccountName appParentID appCreatedDate
1 Home 0 28-07-2012
2 Office 0 28-07-2012
3 Salary 2 29-07-2012
4 Vegetables 1 29-07-2012

when i want to add my home expences into home accountName then i write down in txtSearchAccount after writing home it will display home''s all subcategory
when i select home then it will store appParentID = home''s Primary key .
Please help me .

Thank you in advance.

推荐答案

您可以处理此事件,也可以在事件处理程序中编写所需的任何代码.
You can handle this event, and you can write any code you like in the event handler. Where are you stuck ?


如何在文本框textchanged事件中从数据库填充列表框并选择将值存储到数据库中
步骤:
1.在文件后面的代码中定义TextChanged事件
2.根据传递的搜索条件,用于形成搜索查询
3.根据查询从数据库中检索数据
4.根据检索到的数据在列表框中显示数据.

逐步进行操作,尝试一下并在遇到问题后发布特定问题.您可能会发现这并不困难.
How to populate listbox from database on textbox textchanged event and select value store into database
Steps:
1. Define TextChanged event in your code behind file
2. Based on whatever search criteria is passed, use to form a search query
3. Retrieve data from database based on the query
4. Display the data in listbox based on data retrieved.

Go step by step, try out and post specific issue once faced. You may find that it was not that difficult.


这篇关于如何在文本框textchanged事件上从数据库填充列表框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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