asp.net DataSet的问题 [英] asp.net DataSet releted question

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

问题描述

你好先生,

我的问题是我有DataSet,其中包含学生Table.if我更改了数据集的数据。它反映到服务器

hello sir,
my question is i have DataSet which contain student Table.if i made change into data of dataset.does it reflect to server

推荐答案

由于数据集属于断开连接的体系结构,因此数据不会反映到服务器。您可以更改为数据集的数据。
As dataset comes under disconnected architecture,data will not reflect to the server. You can change into data of dataset.


否,除非您已将更改提交到数据库,否则它将不会影响。

Bcoz数据集是断开连接的架构你需要显式提交对DB的更改
No until and unless you have committed the changes to the DB it will not affect.
Bcoz Datasets are disconnected architecture you need to explicitly commit the changes to the DB


请参阅此链接



ADO.NET中断开的体系结构 [ ^ ]



它声明:



Refer to this link

Disconnected Architecture in ADO.NET[^]

It states that:

Quote:

DataSet:Dataset用于存储dataadapter从数据库中检索的数据将数据填入数据集fill()方法使用dataadapter并使用以下语法。



Da.Fill(Ds,TableName);



调用fill方法时,dataadapter将打开与数据库的连接,执行select命令,将select命令检索到的数据存储到数据集中关闭连接。



由于与数据库的连接已关闭,对数据集中数据的任何更改都不会直接发送到数据库,而只会在数据集中进行。要将对数据集中的数据所做的更改发送到数据库,请使用具有以下语法的dataadapter的Update()方法。



Da.Update( DS, 表名);



调用Update方法后,dataadapter将再次打开与数据库的连接,执行insert,update和delete命令,将数据集中的更改发送到数据库,立即关闭连接。由于连接仅在需要时打开,并且在不需要时自动关闭,因此该体系结构称为断开连接的体系结构。

DataSet : Dataset is used to store the data retrieved from database by dataadapter and make it available for .net application.
To fill data in to dataset fill() method of dataadapter is used and has the following syntax.

Da.Fill(Ds,"TableName");

When fill method was called, dataadapter will open a connection to database, executes select command, stores the data retrieved by select command in to dataset and immediately closes the connection.

As connection to database was closed, any changes to the data in dataset will not be directly sent to the database and will be made only in the dataset. To send changes made to data in dataset to the database, Update() method of the dataadapter is used that has the following syntax.

Da.Update(Ds,"Tablename");

When Update method was called, dataadapter will again open the connection to database, executes insert, update and delete commands to send changes in dataset to database and immediately closes the connection. As connection is opened only when it is required and will be automatically closed when it was not required, this architecture is called disconnected architecture.





问候..:)



Regards..:)


这篇关于asp.net DataSet的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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