检索数千条记录的最佳方法。 [英] best way to retrieve thousands of records.

查看:65
本文介绍了检索数千条记录的最佳方法。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用数据集从sql server访问我的数据

2000.数据集包含3个彼此相关的表。

父/子/孙子关系。我的问题是从bql server检索记录是非常慢的。


我正在使用sqldataadapter.fill方法来填充数据集。 br />
父表包含3,000多条记录,子表包含

超过10,000条记录,而孙表包含超过

90,000条记录。


我试图通过选择命令限制返回的记录数

使用标准,但我的问题是我不知道如何限制

第三个表(孙子)返回的记录数。


我在父表中使用文本框,在第二个和第三个表中使用datagrid。

查询第1和第2表没有问题,但我不知道

如何查询第3个表。第3个表必须首先知道存储在数据网格中的第二个表的主键

值。但不知道

如何做到这一点。


任何人都知道访问这些数据的更好方法是什么?

我很想阅读一些关于访问桌子的技巧的文章

与第三桌(孙子)有关系。


谢谢提前。

解决方案

jaYPee写道:

我目前正在使用数据集从sql server访问我的数据父/子/孙子关系。我的问题是,从sql server检索记录的速度非常慢。

我正在使用sqldataadapter.fill方法来填充数据集。
父表包含多个3,000条记录和子表包含超过10,000条记录,孙表包含超过现在的90,000条记录。

我试图限制返回的记录数量选择命令
使用标准,但我的问题是我不知道如何限制第三个表(孙子)返回的记录数。

我正在使用文本框在父表和第二和第三表中的datagrid。
查询第一和第二表没有问题,但我不知道如何查询第三个表。第3个表必须首先知道存储在数据网格中的第2个表的主键值。但是我不知道
如何做到这一点。

任何人都知道访问这些数据的更好方法是什么?

我很想读一些文章关于访问表格的技巧
与第3表(孙子)有关系。




你打算用3000个父记录做什么?没有人在地球上可以一次性处理那么多行。


我会用更友好的用户系统重新设计你的gui。你当前的

系统需要一个人来浏览3000行才能找到一行来b / b $ b编辑它,相当苛刻/耗时。


Frans。


-

获取LLBLGen Pro,.NET的高效O / R映射: http://www.llblgen.com

我的.NET博客: http://weblogs.asp.net/FBouma

Microsoft MVP(C#)


jaYPee,


我假设你想要一个获取3个表的SQL字符串。


从表1中得到的最少在表中说一个数据行。

表2中相关键的行在表1中
表3中的
来自表2中相关键的行


因为我不喜欢(讨厌)SQL,我认为它更好的是其他人

给你这个答案。


或者你想用3个单独的SQL字符串来做它而不是

在for循环中创建一个你自己的sql字符串,其中包含来自第二个

第三个表的where或子句

http://msdn.microsoft.com/ library / de ... ca-co_2y2h.asp


只是一个想法,不是很好


Cor


" jaYPee" < hi ****** @ yahoo.com>

我目前正在使用数据集从sql server访问我的数据
2000.数据集包含3个表这是彼此相关的。
父母/子女/孙子关系。我的问题是,从sql server检索记录的速度非常慢。

我正在使用sqldataadapter.fill方法来填充数据集。
父表包含多个3,000条记录和子表包含超过10,000条记录,孙表包含超过现在的90,000条记录。

我试图限制返回的记录数量选择命令
使用标准,但我的问题是我不知道如何限制第三个表(孙子)返回的记录数。

我正在使用文本框在父表和第二和第三表中的datagrid。
查询第一和第二表没有问题,但我不知道如何查询第三个表。第3个表必须首先知道存储在数据网格中的第2个表的主键值。但是我不知道
如何做到这一点。

任何人都知道访问这些数据的更好方法是什么?

我很想读一些文章关于访问表格的技巧
与第3表(孙子)有关系。

提前感谢。



< blockquote> jayPee,


新的MSDN系统不再创建可以复制或设置的链接

favits,


所以我在搜索包含并且去了Or,也许你可以自己做那个
。 (sql或稍微点击一下)


Cor


..

" Cor Ligthert" ; < no ************ @ planet.nl>

jaYPee,

我假设你想要一个获取3个表的SQL字符串。

从表1中得到的最少说表中的一个数据行。
表2中表1中相关键的行
表3表2中相关键的行

因为我不喜欢(讨厌)SQL,我认为别人给你这个答案更好。
第二个

http://msdn.microsoft.com/library/de...ca-co_2y2h.asp

只是一个想法,不是很好


" jaYPee" < hi ****** @ yahoo.com>

我目前正在使用数据集从sql server访问我的数据
2000.数据集包含3个表这是彼此相关的。
父母/子女/孙子关系。我的问题是,从sql server检索记录的速度非常慢。

我正在使用sqldataadapter.fill方法来填充数据集。
父表包含多个3,000条记录和子表包含超过10,000条记录,孙表包含超过现在的90,000条记录。

我试图限制返回的记录数量选择命令
使用标准,但我的问题是我不知道如何限制第三个表(孙子)返回的记录数。

我正在使用文本框在父表和第二和第三表中的datagrid。
查询第一和第二表没有问题,但我不知道如何查询第三个表。第3个表必须首先知道存储在数据网格中的第2个表的主键值。但是我不知道
如何做到这一点。

任何人都知道访问这些数据的更好方法是什么?

我很想读一些文章关于访问表格的技巧
与第3表(孙子)有关系。

提前感谢。




I have currently using a dataset to access my data from sql server
2000. The dataset contains 3 tables that is related to each other.
parent/child/grandchild relationship. My problem is it''s very slow to
retrieve records from sql server.

I''m using sqldataadapter.fill method to populate dataset.
Parent table contains more than 3,000 records and child table contains
more than 10,000 records and grandchild table contains more than
90,000 records as of now.

I tried to limit the number of records to return by a select command
using the criteria but my problem is I dont know how to limit the
number of records return by a 3rd table (grandchild).

I''m using textboxes in parent table and datagrid in 2nd and 3rd table.
There is no problem querying the 1st and 2nd table but I don''t know
how to query the 3rd table. 3rd table must know first the primary key
value of the 2nd table that is stored in a datagrid. but don''t know
how to do this.

Anyone know what is the better way to access this data?

I would love to read some article about techniques on accessing table
that has a relationship up to 3rd table (grandchild).

thanks in advance.

解决方案

jaYPee wrote:

I have currently using a dataset to access my data from sql server
2000. The dataset contains 3 tables that is related to each other.
parent/child/grandchild relationship. My problem is it''s very slow to
retrieve records from sql server.

I''m using sqldataadapter.fill method to populate dataset.
Parent table contains more than 3,000 records and child table contains
more than 10,000 records and grandchild table contains more than
90,000 records as of now.

I tried to limit the number of records to return by a select command
using the criteria but my problem is I dont know how to limit the
number of records return by a 3rd table (grandchild).

I''m using textboxes in parent table and datagrid in 2nd and 3rd table.
There is no problem querying the 1st and 2nd table but I don''t know
how to query the 3rd table. 3rd table must know first the primary key
value of the 2nd table that is stored in a datagrid. but don''t know
how to do this.

Anyone know what is the better way to access this data?

I would love to read some article about techniques on accessing table
that has a relationship up to 3rd table (grandchild).



What on earth are you planning to do with 3000 parent records? No human
on earth can handle that much rows in one go.

I''d redesign your gui with a more user friendlier system. Your current
system requires a human to browse through 3000 rows to find a row to
edit it, pretty harsh / time consuming.

Frans.

--
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET Blog : http://weblogs.asp.net/FBouma
Microsoft MVP (C#)


jaYPee,

I assume you want "one" SQL string to get 3 tables.

Where you get from table 1 least say one datarow in a table.
In table 2 the rows from the related key in table 1
in table 3 the rows from the related keys in table 2

Because I don''t like (hate) SQL, I think it is better that somebody else
give you this answer.

Or you should like to do it with 3 seperated SQL strings where you can than
create in a for loop your own sql string with a where or clause for the
third table from the second

http://msdn.microsoft.com/library/de...ca-co_2y2h.asp

Just an idea, not great

Cor

"jaYPee" <hi******@yahoo.com>

I have currently using a dataset to access my data from sql server
2000. The dataset contains 3 tables that is related to each other.
parent/child/grandchild relationship. My problem is it''s very slow to
retrieve records from sql server.

I''m using sqldataadapter.fill method to populate dataset.
Parent table contains more than 3,000 records and child table contains
more than 10,000 records and grandchild table contains more than
90,000 records as of now.

I tried to limit the number of records to return by a select command
using the criteria but my problem is I dont know how to limit the
number of records return by a 3rd table (grandchild).

I''m using textboxes in parent table and datagrid in 2nd and 3rd table.
There is no problem querying the 1st and 2nd table but I don''t know
how to query the 3rd table. 3rd table must know first the primary key
value of the 2nd table that is stored in a datagrid. but don''t know
how to do this.

Anyone know what is the better way to access this data?

I would love to read some article about techniques on accessing table
that has a relationship up to 3rd table (grandchild).

thanks in advance.



jayPee,

That new MSDN system creates no links anymore that can be copied or set in
favorits,

So I was searching on "contains" and went than to Or, maybe you can you do
that yourself. (sql Or gives a little bit to much hits)

Cor

..
"Cor Ligthert" <no************@planet.nl>

jaYPee,

I assume you want "one" SQL string to get 3 tables.

Where you get from table 1 least say one datarow in a table.
In table 2 the rows from the related key in table 1
in table 3 the rows from the related keys in table 2

Because I don''t like (hate) SQL, I think it is better that somebody else
give you this answer.

Or you should like to do it with 3 seperated SQL strings where you can
than create in a for loop your own sql string with a where or clause for
the third table from the second

http://msdn.microsoft.com/library/de...ca-co_2y2h.asp

Just an idea, not great

Cor

"jaYPee" <hi******@yahoo.com>

I have currently using a dataset to access my data from sql server
2000. The dataset contains 3 tables that is related to each other.
parent/child/grandchild relationship. My problem is it''s very slow to
retrieve records from sql server.

I''m using sqldataadapter.fill method to populate dataset.
Parent table contains more than 3,000 records and child table contains
more than 10,000 records and grandchild table contains more than
90,000 records as of now.

I tried to limit the number of records to return by a select command
using the criteria but my problem is I dont know how to limit the
number of records return by a 3rd table (grandchild).

I''m using textboxes in parent table and datagrid in 2nd and 3rd table.
There is no problem querying the 1st and 2nd table but I don''t know
how to query the 3rd table. 3rd table must know first the primary key
value of the 2nd table that is stored in a datagrid. but don''t know
how to do this.

Anyone know what is the better way to access this data?

I would love to read some article about techniques on accessing table
that has a relationship up to 3rd table (grandchild).

thanks in advance.




这篇关于检索数千条记录的最佳方法。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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