输入,分页,排序,大文本文件 [英] inputing, paging, sorting, a large text file

查看:56
本文介绍了输入,分页,排序,大文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要输入一个大的制表符分隔的文本文件,在我允许用户提交之前,我将解析

来检查它是否有预期的列

到数据库。用户可以将文件粘贴到文本框中,或者将其上传

(还没决定)。


我遇到的问题是文本文件由大约3000行组成,并且

我想在将数据库提交给数据库之前向用户显示格式化的列(可能允许他们编辑某些字段,如果他们想要,之后

点击提交)。

显然3000行太多,无法在一个gridview页面上显示 - 所以

问题是::


如何在网格中分页数据,而不必每次解析文本

时间 - 即我可以在哪里存储解析的数据文本,以便我在我的

分页操作中使用它(在插入数据库之前)?


谢谢,

JJ

解决方案

6月7日上午11:56,JJ < a ... @ xyz.comwrote:


我需要输入一个大的制表符分隔文本文件,我将解析

来检查它是否具有预期的列,然后允许用户将数据提交给数据库
。用户可以将文件粘贴到文本框中,或者将其上传

(还没决定)。


我遇到的问题是文本文件由大约3000行组成,并且

我想在将数据库提交给数据库之前向用户显示格式化的列(可能允许他们编辑某些字段,如果他们想要,之后

点击提交)。

显然3000行太多,无法在一个gridview页面上显示 - 所以

问题是::


如何在网格中分页数据,而不必每次解析文本

时间 - 即我可以在哪里存储解析的数据文本,以便我在我的

分页操作中使用它(在插入数据库之前)?


谢谢,

JJ



JJ,

我要考虑的是将文件读取并解析为

DataTable,并使用它绑定到可分页网格。

彼得


嗨彼得,


这就是我所做的(使用了dataTable)。但我注意到,除非我错误地认为每次更改页面索引,否则需要将

网格重新绑定到数据表。我在每个

刷新时丢失了该数据表的内容。要重新创建它,我需要再次解析文本,如果文本文件是3000行,这将是一个很长的过程。


因此我不知道如何在回发中保持大型,格式化的数据库。

我可以将gridview写为用户控件并使用viewstate来实现这样的

大数据表也许?


JJ


< pb ******* @ gmail.comwrote在消息中

新闻:11 ********************** @ q75g2000hsh.googlegr oups.com ...
< blockquote class =post_quotes>
6月7日上午11:56,JJ < a ... @ xyz.comwrote:


>我需要输入一个大的制表符分隔文本文件,我将解析
检查它是否具有预期的列,然后允许用户将数据提交给数据库。用户可以将文件粘贴到文本框中,或上传它(尚未决定)。

我遇到的问题是文本文件包含大约3000行,

我想在将数据库提交给数据库之前向用户显示格式化的列(或许允许他们在需要时编辑某些字段,
br />点击提交)。
显然在一个gridview页面上显示3000行太多 - 所以
问题是::

如何在网格,无需解析文本每个
时间 - 即我可以在哪里存储解析后的文本,以便我在
我的分页操作中使用它(之前将它插入数据库)?

谢谢,
JJ



JJ,

什么我会考虑做的是将文件读取并解析为

DataTable,并使用它绑定到可分页网格。

Peter





" JJ" < ab*@xyz.com写信息

新闻:uU ************** @ TK2MSFTNGP02.phx.gbl ...


嗨彼得,


这就是我所做的(使用了dataTable)。但我注意到,除非我错误地认为每次更改页面索引,否则需要将

网格重新绑定到数据表。我在每个

刷新时丢失了该数据表的内容。要重新创建它,我需要再次解析文本,如果文本文件是3000行,这将是一个很长的过程。


因此我不知道如何在回发中保持大型,格式化的数据库。

我可以将gridview写为用户控件并使用viewstate来实现这样的

可能是大数据?

JJ



为什么不把数据保存在数据库中的临时表?一旦

用户确认更改后,您将所有数据复制到真实表格。


I have a need to input a large tab delimited text file, which I will parse
to check it has the expected columns, before allowing the user to submit it
to the database. The user may paste the file into a textbox, or upload it
(haven''t decided yet).

The problem I have is that the text file consists of around 3000 lines, and
I want to display the formatted columns to the user before submitting it to
the database (perhaps allowing them to edit some fields if they want, before
clicking submit).
Clearly 3000 lines is too much to display on one gridview page - so the
question is::

How can I page the data in the grid, without having to parse the text each
time - i.e. where can I ''store'' the parsed text so that I use that during my
paging operations (prior to inserting it into the database)?

Thanks,
JJ

解决方案

On Jun 7, 11:56 am, "JJ" <a...@xyz.comwrote:

I have a need to input a large tab delimited text file, which I will parse
to check it has the expected columns, before allowing the user to submit it
to the database. The user may paste the file into a textbox, or upload it
(haven''t decided yet).

The problem I have is that the text file consists of around 3000 lines, and
I want to display the formatted columns to the user before submitting it to
the database (perhaps allowing them to edit some fields if they want, before
clicking submit).
Clearly 3000 lines is too much to display on one gridview page - so the
question is::

How can I page the data in the grid, without having to parse the text each
time - i.e. where can I ''store'' the parsed text so that I use that during my
paging operations (prior to inserting it into the database)?

Thanks,
JJ

JJ,
What I''d consider doing is to read and parse the file into a
DataTable, and use this to bind to a pageable grid.
Peter


Hi Peter,

Thats what I''ve done (used a dataTable that is). But I notice, unless I''m
mistaken, that each time you change the page index, you need to rebind the
grid to the datatable. I lose the contents of that datatable on each
refresh. To recreate it I need to parse the text again, which will be a
lengthy process if the text file is 3000 lines.

I''m therefore at a loss as to how to keep hold of the large, formatted
datatable throughout postbacks.
Could I write the gridview as a user control and use viewstate for such a
large datatable perhaps?

JJ

<pb*******@gmail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...

On Jun 7, 11:56 am, "JJ" <a...@xyz.comwrote:

>I have a need to input a large tab delimited text file, which I will
parse
to check it has the expected columns, before allowing the user to submit
it
to the database. The user may paste the file into a textbox, or upload it
(haven''t decided yet).

The problem I have is that the text file consists of around 3000 lines,
and
I want to display the formatted columns to the user before submitting it
to
the database (perhaps allowing them to edit some fields if they want,
before
clicking submit).
Clearly 3000 lines is too much to display on one gridview page - so the
question is::

How can I page the data in the grid, without having to parse the text
each
time - i.e. where can I ''store'' the parsed text so that I use that during
my
paging operations (prior to inserting it into the database)?

Thanks,
JJ


JJ,
What I''d consider doing is to read and parse the file into a
DataTable, and use this to bind to a pageable grid.
Peter




"JJ" <ab*@xyz.comwrote in message
news:uU**************@TK2MSFTNGP02.phx.gbl...

Hi Peter,

Thats what I''ve done (used a dataTable that is). But I notice, unless I''m
mistaken, that each time you change the page index, you need to rebind the
grid to the datatable. I lose the contents of that datatable on each
refresh. To recreate it I need to parse the text again, which will be a
lengthy process if the text file is 3000 lines.

I''m therefore at a loss as to how to keep hold of the large, formatted
datatable throughout postbacks.
Could I write the gridview as a user control and use viewstate for such a
large datatable perhaps?

JJ

Why don''t you save the data in the temporary table in the database? Once
user confirmed the changes you will copy all data to the real table.


这篇关于输入,分页,排序,大文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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