如何在页面之间存储数据数组? [英] How do I store an array of data between pages?

查看:126
本文介绍了如何在页面之间存储数据数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望这是有道理的!


我正在构建一个ASP页面,允许用户通过表单将项目添加到发票

,即:


项目编号零件编号订单无数量单位价格增值税

------- ------- ----- --- ------- ----- ----- ---

...... ...... ...... ...... ...


<添加项目> <提交>


我想要做的是让用户一次添加一个项目(因为我们

不知道有多少项目要去添加),并慢慢建立

一系列记录。


为此,用户将使用表格(如上所述)持有

他们用来添加第一项。然后,他们点击<添加商品>

按钮。这将把数据提交给要验证的ASP脚本。

然后将数据添加到数组中,用户返回到

发票页面。

然后我会在

项目条目下显示他们已经输入的行(如上所示)。然后他们添加另一行并点击< Add

item>并重复该过程,直到所有项目都已添加。

最后用户点击提交,数据存储在数据库中。


为此我做显然需要将每个新行存储在一个数组中。但是

我刚刚意识到我不能这样做,除非我将数组本身存储在一个会话变量中。
。这是可接受的,还是另一种方法

可以支持这个?


TIA,


Colin

解决方案

您是否考虑过使用数据库?此外,你总是可以在会话中存储一个本地的

数组,使用Session(array)= localArray ...只需记住

将它带回本地试图迭代它或操纵它。


-

Aaron Bertrand

SQL Server MVP
http://www.aspfaq.com/

>
" Colin Steadman" <去**** @ colinsteadman.com>在消息中写道

新闻:40 ************************* @ posting.google.co m ... < blockquote class =post_quotes>希望这是有道理的!

我正在构建一个ASP页面,允许用户通过表单将项目添加到发票中,即:

项目编号零件编号订单无数量单位价格增值税
------- ------- -------- ------- - --- ----- ---
............ ............

<添加项目> <提交>

我想要做的是让用户一次添加一个项目(因为我们不知道要添加多少项目),然后慢慢积累
一系列记录。

要做到这一点,用户将使用表格(如上所述)进行操作,这些表格用于添加第一项。然后,他们点击<添加项目>
按钮。这将把数据提交给要验证的ASP脚本。
然后将数据添加到数组中,用户返回到
发票页面。

然后我会显示他们已在
项目条目下方输入的行(如上所示)。然后他们添加另一行并单击< Add
item>并且重复该过程,直到所有项目都被添加。
最后用户单击Submit并将数据存储在数据库中。

为此,我显然需要将每个新行存储在数组。但是我已经意识到除非我将数组本身存储在会话变量中,否则我无法做到这一点。这是可以接受的,还是可以支持的另一种方法?

TIA,

Colin



你也可以做这个客户端。单击该按钮只会添加一个新的

空白。线路到桌面客户端,用户将在准备好后提交整个

表格?


Patrice

" Colin斯特德曼" <去**** @ colinsteadman.com> écritdansle message de

news:40 ************************* @ posting.google.co m。 ..

希望这是有道理的!

我正在构建一个ASP页面,允许用户通过表单将项目添加到发票中,即:

项目无部分无订单无量化单位价格增值税
------- ------- -------- ------ - ----- ----- ---
............ ............

< Add项> <提交>

我想要做的是让用户一次添加一个项目(因为我们不知道要添加多少项目),然后慢慢积累
一系列记录。

要做到这一点,用户将使用表格(如上所述)进行操作,这些表格用于添加第一项。然后,他们点击<添加项目>
按钮。这将把数据提交给要验证的ASP脚本。
然后将数据添加到数组中,用户返回到
发票页面。

然后我会显示他们已在
项目条目下方输入的行(如上所示)。然后他们添加另一行并单击< Add
item>并且重复该过程,直到所有项目都被添加。
最后用户单击Submit并将数据存储在数据库中。

为此,我显然需要将每个新行存储在数组。但是我已经意识到除非我将数组本身存储在会话变量中,否则我无法做到这一点。这是可以接受的,还是可以支持的另一种方法?

TIA,

Colin



使用xml客户端或服务器端。


您可以在客户端添加到xml数据岛,然后在准备好时将xml发送到客户端。


''来自dlbjr


''从对其他人的微薄知识中解脱出来,产生未知的睿智。


Hope this makes sense!

I''m building an ASP page which allows uses to add items to an invoice
via a form, ie:

Item No Part No Order No Quanity Units Price VAT
------- ------- -------- ------- ----- ----- ---
.... ... ... ... ... ... ...

<Add item> <Submit>

What I want to do is have the user add one item at a time (because we
dont know how many items are going to be added), and slowly build up
an array of records.

To do this the user will be persented with a form (as above) which
they use to add the first item. They then click the <Add item>
button. This will submit the data to an ASP script to be validated.
The data is then added to an array and the user is returned to the
invoice page.

I will then display the line they have already entered beneath the
item entry (shown above). They then add another line and click <Add
item> and the process is repeated until all items have been added.
Finally the user clicks Submit and the data is stored in the database.

To do this I obviously need to store each new line in an array. But
I''ve just realised that I cant do this unless I store the array itself
in a session variable. Is this acceptable, or is another method
available that would support this?

TIA,

Colin

解决方案

Have you considered using a database? Also, you can always store a local
array in the session, using Session("array") = localArray... just remember
to bring it back local before trying to iterate through it or manipulate it.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Colin Steadman" <go****@colinsteadman.com> wrote in message
news:40*************************@posting.google.co m...

Hope this makes sense!

I''m building an ASP page which allows uses to add items to an invoice
via a form, ie:

Item No Part No Order No Quanity Units Price VAT
------- ------- -------- ------- ----- ----- ---
... ... ... ... ... ... ...

<Add item> <Submit>

What I want to do is have the user add one item at a time (because we
dont know how many items are going to be added), and slowly build up
an array of records.

To do this the user will be persented with a form (as above) which
they use to add the first item. They then click the <Add item>
button. This will submit the data to an ASP script to be validated.
The data is then added to an array and the user is returned to the
invoice page.

I will then display the line they have already entered beneath the
item entry (shown above). They then add another line and click <Add
item> and the process is repeated until all items have been added.
Finally the user clicks Submit and the data is stored in the database.

To do this I obviously need to store each new line in an array. But
I''ve just realised that I cant do this unless I store the array itself
in a session variable. Is this acceptable, or is another method
available that would support this?

TIA,

Colin



Also you could do this client side. Clicking the button would just add a new
"blank" line to the table client side and the user will submit the whole
form when ready ??

Patrice
"Colin Steadman" <go****@colinsteadman.com> a écrit dans le message de
news:40*************************@posting.google.co m...

Hope this makes sense!

I''m building an ASP page which allows uses to add items to an invoice
via a form, ie:

Item No Part No Order No Quanity Units Price VAT
------- ------- -------- ------- ----- ----- ---
... ... ... ... ... ... ...

<Add item> <Submit>

What I want to do is have the user add one item at a time (because we
dont know how many items are going to be added), and slowly build up
an array of records.

To do this the user will be persented with a form (as above) which
they use to add the first item. They then click the <Add item>
button. This will submit the data to an ASP script to be validated.
The data is then added to an array and the user is returned to the
invoice page.

I will then display the line they have already entered beneath the
item entry (shown above). They then add another line and click <Add
item> and the process is repeated until all items have been added.
Finally the user clicks Submit and the data is stored in the database.

To do this I obviously need to store each new line in an array. But
I''ve just realised that I cant do this unless I store the array itself
in a session variable. Is this acceptable, or is another method
available that would support this?

TIA,

Colin



Use xml Client or server side.

You can add to an xml data island on client side then send xml to client when ready.

''from dlbjr

''Unambit from meager knowledge of inane others,engender uncharted sagacity.


这篇关于如何在页面之间存储数据数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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