DataSet.Select [英] DataSet.Select

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

问题描述

有没有办法做一个DataSet.Select()语句并使用多个

选择" query"?例如,使用DataSet.Select(IDNum> 32)选择所有

行,而不是仅选择

的所有行IDNum大于32 IDNum> 32和地区=中西部。这可能吗?

Is there any way to do a DataSet.Select() statement and use more than one
selection "query"? For instance, instead of just selecting all rows where
the IDNum is greater than 32 with DataSet.Select("IDNum > 32"), select all
rows where the IDNum > 32 and the Region = Midwest. Is this possible?

推荐答案

Nathan,

DataSet没有Select方法,你的意思是DataTable.Select吗?


我所知道的唯一一个记录DataSet OM

中表达式的语法的地方是DataColumn.Expression帮助主题:

http://msdn.microsoft.com/library/de...ssionTopic.asp


有一个AND运算符,所以你可以使用类似的东西: br />

Dim table As DataTable

Dim rows()As DataRow

rows = table.Select(" IDNum> 32 And Region =''Midwest'')


希望这有帮助

Jay


" Nathan" < NK ********************* @ softhome.net>在留言中写道

新闻:O6 ************* @ TK2MSFTNGP10.phx.gbl ...
Nathan,
DataSet does not have a Select method, do you mean DataTable.Select?

The only place I know of where the syntax that expressions in the DataSet OM
is documented is the DataColumn.Expression help topic:

http://msdn.microsoft.com/library/de...ssionTopic.asp

There is an AND operator so you can use something like:

Dim table As DataTable
Dim rows() As DataRow
rows = table.Select("IDNum > 32 And Region = ''Midwest'')

Hope this helps
Jay

"Nathan" <nk*********************@softhome.net> wrote in message
news:O6*************@TK2MSFTNGP10.phx.gbl...
有什么办法可以做一个DataSet.Select()语句并使用多个
选择" query"?例如,不是仅使用DataSet.Select(IDNum> 32)选择IDNum大于32的所有行,而是选择IDNum>所有的行。 32和地区=中西部。这可能吗?
Is there any way to do a DataSet.Select() statement and use more than one
selection "query"? For instance, instead of just selecting all rows where
the IDNum is greater than 32 with DataSet.Select("IDNum > 32"), select all
rows where the IDNum > 32 and the Region = Midwest. Is this possible?



当然,您可以使用AND运算符:


myDataTable。选择(IDNum> 32 AND Region =" MidWest)


更多信息:

http://tinyurl.com/2cvqh


允许使用布尔AND,OR和连接进行连接不是运营商。你可以

使用括号来分组子句并强制优先。 AND运算符优先于其他运算符
。例如:


(LastName =''Smith''或LastName =''Jones'')和FirstName =''John''

-

Greetz


Jan Tielens

________________________________

阅读我的博客: http://weblogs.asp.net/jan

" Nathan" < NK ********************* @ softhome.net>在留言中写道

新闻:O6 ************* @ TK2MSFTNGP10.phx.gbl ...
Sure, you can use the AND operator:

myDataTable.Select("IDNum > 32 AND Region = "MidWest")

More info:

http://tinyurl.com/2cvqh

Concatenation is allowed using Boolean AND, OR, and NOT operators. You can
use parentheses to group clauses and force precedence. The AND operator has
precedence over other operators. For example:

(LastName = ''Smith'' OR LastName = ''Jones'') AND FirstName = ''John''
--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Nathan" <nk*********************@softhome.net> wrote in message
news:O6*************@TK2MSFTNGP10.phx.gbl...
有什么办法可以做一个DataSet.Select()语句并使用多个
选择" query"?例如,不是仅使用DataSet.Select(IDNum> 32)选择IDNum大于32的所有行,而是选择IDNum>所有的行。 32和地区=中西部。这可能吗?
Is there any way to do a DataSet.Select() statement and use more than one
selection "query"? For instance, instead of just selecting all rows where
the IDNum is greater than 32 with DataSet.Select("IDNum > 32"), select all
rows where the IDNum > 32 and the Region = Midwest. Is this possible?



你好Jan,


" Jan Tielens" < ja*@no.spam.please.leadit.be>在消息中写道

新闻:uQ ************** @ TK2MSFTNGP09.phx.gbl ...
Hi Jan,

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:uQ**************@TK2MSFTNGP09.phx.gbl...
当然,你可以使用AND运算符:

myDataTable.Select(" IDNum> 32 AND Region =" MidWest")
Sure, you can use the AND operator:

myDataTable.Select("IDNum > 32 AND Region = "MidWest")




忘了单词括号? :)

.... Region =''MidWest''")


-

Miha Markic - RightHand .NET咨询&软件开发

miha at rthand com
www.rthand.com


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

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