DataAdapter更新 [英] DataAdapter update

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

问题描述

我倾向于在WinForms项目中使用SqlDataAdapter类,因为一旦加载了

初始数据,任何修改都可以通过

a调用更新轻松添加/更新( ) 方法。我在aspnet中发现同样的东西是

可能但是由于网络的无状态性质才能做到这一点

我必须经历以下步骤:


1.首次访问页面加载DataSet并将DataList与数据绑定

2.用户编辑数据并提交页面

3.使用原始数据重新加载DataSet,如1所示。

4.遍历DataList并更新DataSet中的行

5.调用Update()方法更新已编辑的行


现在我正确地执行此操作还是有任何方法可以跳过第3步?它只是更新DataList中的每一行似乎比仅通过更新修改行的

过程更容易。

解决方案

Janaka,


您只需将其添加到session.item

session.item(" ; ds")= ds


当然还有回来。


我希望这会有所帮助


Cor

" Janaka" < ja **** @ magicalia.com>

..

我倾向于在WinForms项目中使用SqlDataAdapter类,因为一旦
的初始数据是通过调用Update()方法可以轻松添加/更新
。我在aspnet中发现同样的东西
是可能的,但由于网络的无状态性质,为了做
,我必须经历以下步骤:

2.用户编辑数据并提交页面
3.使用原始数据重新加载DataSet,如1所示。
4。迭代DataList并更新DataSet中的行
5.调用Update()方法更新已编辑的行

现在我正确地执行此操作还是有任何方法可以跳过第3步?它只是更新DataList中的每一行似乎比只更新修改过的行更简单。



我相信将数据集保存到视图状态可以解决您的问题,

但请注意臭名昭着的无效视图状态。错误!!!


我认为有更好的解决方案。任何人???


" Janaka" < JA **** @ magicalia.com>在消息中写道

新闻:OC ************** @ TK2MSFTNGP15.phx.gbl ...

我倾向于使用WinForms项目中的SqlDataAdapter类因为一旦加载了初始数据,就可以通过调用Update()方法轻松添加/更新任何修改。我在aspnet中发现同样的事情是可能的,但由于网络的无状态性质,为了做到这一点,我必须完成以下步骤:

2.用户编辑数据并提交页面
3.使用原始数据重新加载DataSet,如1所示。
4。迭代DataList并更新DataSet中的行
5.调用Update()方法更新已编辑的行

现在我正确地执行此操作还是有任何方法可以跳过第3步?它只是更新DataList中的每一行似乎比只更新修改过的行更简单。



谢谢,这也是我的选择,使用会话状态,应用程序不是
所以我不能在会话中存储任何对象。

Cor Ligthert ; <无********** @ planet.nl>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP15.phx.gbl ...

Janaka,

你可以把它添加到session.item
session.item(" ds")= ds

然后再回来了。

我希望这会有所帮助

Cor
Janaka < ja **** @ magicalia.com>

我倾向于在WinForms项目中使用SqlDataAdapter类,因为一旦


加载初始数据任何修改都可以轻松添加/更新


通过

调用Update()方法。我在aspnet中发现同样的事情


可能但是由于网络的无状态性质


这个

我必须完成以下步骤:

1.首先访问页面加载DataSet并将DataList与数据绑定
2.用户编辑数据和提交页面
3.使用原始数据重新加载DataSet,如1所示。
4.遍历DataList并更新DataSet中的行
5.调用Update()方法更新已编辑的行

现在我正确地这样做了,还是有什么方法可以跳过第3步?它只是更新DataList中的每一行似乎比只更新修改过的行更简单。




I tend to use the SqlDataAdapter class in WinForms projects because once the
inital data is loaded any modifications can be easily added/updated through
a call to the Update() method. I''ve found in aspnet that the same thing is
possible but because of the stateless nature of the web in order to do this
I have to go through the following steps:

1. First visit to page loads DataSet and binds DataList with data
2. User edits data and submits the pages
3. Reload the DataSet with original data as in 1.
4. Iterate through the DataList and updates rows in the DataSet
5. Call the Update() method to update edited rows

Now am I doing this correctly or is there any way I can skip step 3? It
seems easier to just update each row in the DataList than go through the
process of only updating modified rows.

解决方案

Janaka,

You can just add it to a session.item
session.item("ds")=ds

And than back again of course.

I hope this helps

Cor
"Janaka" <ja****@magicalia.com>
..

I tend to use the SqlDataAdapter class in WinForms projects because once the inital data is loaded any modifications can be easily added/updated through a call to the Update() method. I''ve found in aspnet that the same thing is possible but because of the stateless nature of the web in order to do this I have to go through the following steps:

1. First visit to page loads DataSet and binds DataList with data
2. User edits data and submits the pages
3. Reload the DataSet with original data as in 1.
4. Iterate through the DataList and updates rows in the DataSet
5. Call the Update() method to update edited rows

Now am I doing this correctly or is there any way I can skip step 3? It
seems easier to just update each row in the DataList than go through the
process of only updating modified rows.



i believe saving the dataset into a viewstate would solve your problem,
but beware of the infamous "invalid viewstate" error!!!

I think there is a better solution out there though. anyone???

"Janaka" <ja****@magicalia.com> wrote in message
news:OC**************@TK2MSFTNGP15.phx.gbl...

I tend to use the SqlDataAdapter class in WinForms projects because once
the inital data is loaded any modifications can be easily added/updated
through a call to the Update() method. I''ve found in aspnet that the same
thing is possible but because of the stateless nature of the web in order
to do this I have to go through the following steps:

1. First visit to page loads DataSet and binds DataList with data
2. User edits data and submits the pages
3. Reload the DataSet with original data as in 1.
4. Iterate through the DataList and updates rows in the DataSet
5. Call the Update() method to update edited rows

Now am I doing this correctly or is there any way I can skip step 3? It
seems easier to just update each row in the DataList than go through the
process of only updating modified rows.



Thanks that would be my choice as well, howerver the application is not
using Session state so I cannot store any objects in a session.
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...

Janaka,

You can just add it to a session.item
session.item("ds")=ds

And than back again of course.

I hope this helps

Cor
"Janaka" <ja****@magicalia.com>
.

I tend to use the SqlDataAdapter class in WinForms projects because once


the

inital data is loaded any modifications can be easily added/updated


through

a call to the Update() method. I''ve found in aspnet that the same thing


is

possible but because of the stateless nature of the web in order to do


this

I have to go through the following steps:

1. First visit to page loads DataSet and binds DataList with data
2. User edits data and submits the pages
3. Reload the DataSet with original data as in 1.
4. Iterate through the DataList and updates rows in the DataSet
5. Call the Update() method to update edited rows

Now am I doing this correctly or is there any way I can skip step 3? It
seems easier to just update each row in the DataList than go through the
process of only updating modified rows.




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

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