如何从组合框参数化查询? [英] how to parameterized query from combo box?

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

问题描述

我有2个组合框:

第一个组合框将显示老师的姓名,第二个组合框将显示该老师所教的所有主题,我的问题是我不知道如何使用ado.net(VB.NET)对其进行编程,请帮助我在编码这种情况下:)

它适用于Windows,请给我一些有关它的示例代码
感谢

Hi I have 2 combo-box :

1st combobox will show the teacher''s name and the 2nd combo box will show all the subject that this particular teacher teach ,my problem is I don''t know how to program it using ado.net (VB.NET) please help me in coding this scenario :)

Its for windows and please give me some sample code about it
thanks

推荐答案

您正在寻找的功能称为层叠下拉菜单

将CascadingDropDown与数据库一起使用 [
The functionality you are looking for is called cascading dropdown

Using CascadingDropDown with a Database[^]

You didn''t specify if this were Web or Windows but the technique is the same, just applied differently in each.


双击要查询的combox....并用连接来写查询,并在查询中写--WHERE field =& ComboBox1.text&" ....


尝试此操作,您将得到答案....
double click on combox on which you want to query .... and there write querty with with connection and in query write like -- WHERE field=" & ComboBox1.text & "....


try this u wil get the thing....


实际上,MSDN在ADO.NET上有很多文章,它们可以为您提供的信息比这里的任何人都能得到的答案还多.
因此,我建议您从那里开始阅读,如果遇到某个主题或一段代码,请回到这里.
ADO.NET概述 [ IDbCommand(所有DbCommand对象的基本接口) [ DbCommand(IDbCommand的基本实现) [ OleDbCommand(IDbCommand的实现,继承自DbCommand) [ ^ ]
SqlCommand(使用SQL时使用的命令) [ ^ ]

对于参数化查询:
IDbDataParameter的衍生物 [ IDbConnection的衍生物 [ IDataAdapter的衍生物 [完整的代码示例 [可理解的方法:在TreeView中显示分层数据(例如,教师-班级) [ ^ ]

给一个人一条鱼,他会吃一天,教他如何钓鱼,他会一辈子吃东西(或其他).
祝你好运! :)
Actually MSDN has quite some articles on ADO.NET which can tell you more than anyone here could fit it an answer.
So I suggest you start reading there and come back here if you get stuck on a subject or piece of code.
ADO.NET Overview[^]

Command Object, for executing queries:
IDbCommand (the base Interface for all DbCommand Objects)[^]
DbCommand (basic Implementation of IDbCommand)[^]
OleDbCommand (an Implementation of IDbCommand, Inherits from DbCommand)[^]
SqlCommand (Command to use when working with SQL)[^]

For parameterized queries:
Derivatives of IDbDataParameter[^]

Other Objects you will need:
Derivatives of IDbConnection[^]
Derivatives of IDataAdapter[^]

How to''s:
Complete code samples[^]
Walkthough: Displaying hierarchical data in a TreeView (for example teacher - classes)[^]

Give a man a fish and he will eat for a day, teach him how to fish and he will eat for a lifetime (or something).
Good luck! :)


这篇关于如何从组合框参数化查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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