-2

好吧,我有一个包含 2bigint列的表。

例子

val1 3213 12312
val2 13232 32322
.
.
.

select val from table where 3232 between col1 and col2

我需要使用 between 运算符来选择单行数据。

现在我尝试dataview了,但失败了。Dataview 不支持between运营商。

像这样

dwIpAddress.RowFilter = string.Format("{0} between CodeVal_1 and CodeVal_2", irParameter);

那么我可以使用哪种方法?

大约有 200000 条数据记录。

试过这个,它超级慢

    dwIpAddress.RowFilter = string.Format("CodeVal_1>= {0} and CodeVal_2<={0}", irParameter);

C# 4.0

4

1 回答 1

1

你有没有尝试过

    dwIpAddress.RowFilter = string.Format("CodeVal_1 <= {0} and {0} <= CodeVal_2", irParameter);

此外,由于您提到您使用的是 C# 4.0,因此您可以使用实体框架来代替 DataView。你可能想要调查的东西。

此外,如果您的 DataView 包含数据库表中的所有记录,那么您可能需要调整您的查询,以便它只从数据库中获取它需要的行,而不是返回所有行然后在 C# 中过滤(如果这是你在做)

于 2012-12-23T01:42:10.073 回答