如何用C#语言实现数据库系统通用查询功能
我目前在用VS2005(C#语言)开发一个数据库系统,后台数据库建立在Oracle数据库中,此系统包括一个主窗口,主窗口包含若干个子窗口。现在想实现系统的通用查询功能,即...
我目前在用VS2005(C#语言)开发一个数据库系统,后台数据库建立在Oracle数据库中,此系统包括一个主窗口,主窗口包含若干个子窗口。现在想实现系统的通用查询功能,即点击任意子窗口中工具栏上的“查询”按钮,则出现一查询界面(整个系统仅有这一个通用的查询界面),在查询界面上选择查询的关系(并且、或者)、字段名(子窗口界面显示的相应表字段的中文名)、条件(等于、包含、大于、小于等),输入查询值,然后点击确定按钮即可将查询的结果显示在原子窗口界面上的DataGridView里。 我见过有人用dephi语言实现了此功能,可我不懂dephi语言,而且目前在用C#开发。请大家帮忙想想办法,谢谢了!
展开
展开全部
查询功能是用where语句拼条件
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
从数据库中检索行,并允许从一个或多个表中选择一个或多个行或列。虽然 SELECT 语句的完整语法较复杂,但其主要子句可归纳如下:
[ WITH <common_table_expression>]
SELECT select_list [ INTO new_table ]
[ FROM table_source ] [ WHERE search_condition ]
[ GROUP BY group_by_expression]
[ HAVING search_condition]
[ ORDER BY order_expression [ ASC | DESC ] ]
可在查询之间使用 UNION、EXCEPT 和 INTERSECT 运算符,以便将各个查询的结果合并或比较到一个结果集中。
Transact-SQL 语法约定
语法
SELECT statement ::= [WITH <common_table_expression> [,...n]]
<query_expression>
[ ORDER BY { order_by_expression | column_position [ ASC | DESC ] }
[ ,...n ] ]
[ COMPUTE
{ { AVG | COUNT | MAX | MIN | SUM } ( expression ) } [ ,...n ]
[ BY expression [ ,...n ] ]
]
[ <FOR Clause>]
[ OPTION ( <query_hint> [ ,...n ] ) ]
<query expression> ::=
{ <query specification> | ( <query expression> ) }
[ { UNION [ ALL ] | EXCEPT | INTERSECT }
<query specification> | ( <query expression> ) [...n ] ]
<query specification> ::=
SELECT [ ALL | DISTINCT ]
[TOP expression [PERCENT] [ WITH TIES ] ]
< select_list >
[ INTO new_table ]
[ FROM { <table_source> } [ ,...n ] ]
[ WHERE <search_condition> ]
[ GROUP BY [ ALL ] group_by_expression [ ,...n ]
[ WITH { CUBE | ROLLUP } ]
]
[ HAVING < search_condition > ]
备注
由于 SELECT 语句的复杂性,下面按子句说明详细的语法元素和参数:
WITH common_table_expression
UNION
SELECT 子句
EXCEPT 和 INTERSECT
INTO 子句
ORDER BY
FROM
COMPUTE
WHERE
FOR 子句
GROUP BY
OPTION 子句
HAVING
[ WITH <common_table_expression>]
SELECT select_list [ INTO new_table ]
[ FROM table_source ] [ WHERE search_condition ]
[ GROUP BY group_by_expression]
[ HAVING search_condition]
[ ORDER BY order_expression [ ASC | DESC ] ]
可在查询之间使用 UNION、EXCEPT 和 INTERSECT 运算符,以便将各个查询的结果合并或比较到一个结果集中。
Transact-SQL 语法约定
语法
SELECT statement ::= [WITH <common_table_expression> [,...n]]
<query_expression>
[ ORDER BY { order_by_expression | column_position [ ASC | DESC ] }
[ ,...n ] ]
[ COMPUTE
{ { AVG | COUNT | MAX | MIN | SUM } ( expression ) } [ ,...n ]
[ BY expression [ ,...n ] ]
]
[ <FOR Clause>]
[ OPTION ( <query_hint> [ ,...n ] ) ]
<query expression> ::=
{ <query specification> | ( <query expression> ) }
[ { UNION [ ALL ] | EXCEPT | INTERSECT }
<query specification> | ( <query expression> ) [...n ] ]
<query specification> ::=
SELECT [ ALL | DISTINCT ]
[TOP expression [PERCENT] [ WITH TIES ] ]
< select_list >
[ INTO new_table ]
[ FROM { <table_source> } [ ,...n ] ]
[ WHERE <search_condition> ]
[ GROUP BY [ ALL ] group_by_expression [ ,...n ]
[ WITH { CUBE | ROLLUP } ]
]
[ HAVING < search_condition > ]
备注
由于 SELECT 语句的复杂性,下面按子句说明详细的语法元素和参数:
WITH common_table_expression
UNION
SELECT 子句
EXCEPT 和 INTERSECT
INTO 子句
ORDER BY
FROM
COMPUTE
WHERE
FOR 子句
GROUP BY
OPTION 子句
HAVING
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询