刷新数据集的最佳方法。 [英] best way to refresh a dataset.

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

问题描述

我有一个函数调用执行

insert命令的存储过程。现在我想刷新数据集,以便新的

插入数据可用于我的数据网格


我试图调用


DsStudentCourse1.Tables(" SchYrSemCourseJoin").Clea r()

SqlDataAdapter3.Fill(DsStudentCourse1)


然而,填充方法会导致很多时间处理。


任何人都知道再次填充/刷新数据集的最佳方法是什么

新插入的记录将我的数据网格可用吗?


提前感谢。

解决方案




如果要加载到数据集的数据相对较大,调用fill方法的最佳方式是通过异步回调方法,这将是

创建一个与主线程并行运行的独立线程。当

新线程完成后,回调机制将让主线程知道操作完成后的
,以便您可以显示结果。在最近的MSDN杂志文章中查看更多

: -
http://msdn.microsoft.com/msdnmag/is...asicInstincts/


问候

Joyjit


" jaYPee" <喜****** @ yahoo.com>在消息中写道

新闻:0k ******************************** @ 4ax.com ...

我有一个函数调用执行
插入命令的存储过程。现在我想刷新数据集,以便新的
插入数据可用于我的数据网格

我试图调用

DsStudentCourse1.Tables(" SchYrSemCourseJoin").Clea r()
SqlDataAdapter3.Fill(DsStudentCourse1)

然而,填充方法会导致大量时间处理。

任何人都知道什么是再次填充/刷新数据集的最佳方式,以便新插入的记录可用于我的数据网格吗?

提前感谢。



Joyjit,


我经常这样做。你能告诉我这有什么好处吗?

这个样本你现在必须要监视工作是否完成。


用户只对此感兴趣他的屏幕没有被冻结,但是在做

的时候,这可以看到一些东西。


它为我找到一个很好的方法让程序员感到非常自豪

但是对于最终用户来说,它在我看来并没有任何好处,除了

他可以在数据网格更新时关闭他的应用程序。

这意味着当出现错误时,这些错误从未被捕获,并且您的

数据库在中间某处出现错误。 (当然也可以在

线程中获取,但是只会让它变得更加困难,因为

与UI的通信)

我认为当你想要使用dataadapter事件这种事情时,

是一种更好的方法。

http://msdn.microsoft .com / library / de ... nts.asp然而,只是我的想法,当我看到错误时告诉我?CoirJoyjit Mukherjee <乔************** @ hotmail.com>>您好,>>如果要加载到数据集的数据相对较大,则最佳方法是>调用fill方法是通过异步的回调方法,这将是>创建一个单独的线程与主线程并行运行。当>>新线程完成回调机制将让主线程知道>操作已完成,以便您可以显示结果。查看更多>在最近的MSDN杂志文章中: - > http://msdn.microsoft.com/msdnmag/issues/04/01/BasicInstincts/>>此致> Joyjit>> " JAYPEE" <喜****** @ yahoo.com>在消息中写道>新闻:0k ******************************** @ 4ax.com ...>>我有一个函数调用存储过程执行>>插入命令。现在我想刷新数据集,以便新的>>插入的数据可用于我的数据网格>>>>我试着打电话给>>>> DsStudentCourse1.Tables(" SchYrSemCourseJoin")。Clea r()>> SqlDataAdapter3.Fill(DsStudentCourse1)GT;>>>但是,填充方法会导致大量时间进行处理。>>>>任何人都知道什么是再次填充/刷新数据集的最佳方法,所以>>新插入的记录可用于我的数据网格?>>>>提前谢谢。>>


似乎出现了问题。

http://msdn.microsoft.com/ library / de ... iderEvents.asp



Cor

I have a function that call a stored procedure which performs an
insert command. now i want to refresh the dataset so that the newly
inserted data will be available to my datagrid

I have tried to call

DsStudentCourse1.Tables("SchYrSemCourseJoin").Clea r()
SqlDataAdapter3.Fill(DsStudentCourse1)

However, the fill method causes a lot of time to process.

anyone know what is the best way to fill/refresh the dataset again so
that the newly inserted records will be available to my datagrid?

thanks in advance.

解决方案

Hi,

if the data to be loaded to the dataset is relatively large, the best way of
calling the fill method is via a callback method asynchronously which will
create a separate thread to run in parallel with the main thread. When the
new thread is finished the callback mechanism will let the main thread know
that the operation is finished, so that you can show the results. See more
in this recent MSDN magazine article: -
http://msdn.microsoft.com/msdnmag/is...asicInstincts/

Regards
Joyjit

"jaYPee" <hi******@yahoo.com> wrote in message
news:0k********************************@4ax.com...

I have a function that call a stored procedure which performs an
insert command. now i want to refresh the dataset so that the newly
inserted data will be available to my datagrid

I have tried to call

DsStudentCourse1.Tables("SchYrSemCourseJoin").Clea r()
SqlDataAdapter3.Fill(DsStudentCourse1)

However, the fill method causes a lot of time to process.

anyone know what is the best way to fill/refresh the dataset again so
that the newly inserted records will be available to my datagrid?

thanks in advance.



Joyjit,

I have readed this often. Can you tell me what is the benefit from this,
with this sample you now have to monitor that the work is done.

The user is only interested that his screen is not freezed but while doing
this can see something.

It looks for me a nice method for the programmer who can be very proud on
it, however for the enduser it gives in my opinion not any benefit except
that he can close his application while the datagrid is updating.

Which means that when there are errors those are never catched and your
database has errors somewhere in the middle. (Which can be catched in the
thread of course as well however makes it only more difficult, because of
the communication with the UI )

I think that when you want this kind of things using the dataadapter events
are a much better way to do this.

http://msdn.microsoft.com/library/de...nts.aspHowever just my thought, and when I see something wrong tell me?Coir"Joyjit Mukherjee" <jo**************@hotmail.com>> Hi,>> if the data to be loaded to the dataset is relatively large, the best wayof> calling the fill method is via a callback method asynchronously which will> create a separate thread to run in parallel with the main thread. When the> new thread is finished the callback mechanism will let the main threadknow> that the operation is finished, so that you can show the results. See more> in this recent MSDN magazine article: -> http://msdn.microsoft.com/msdnmag/issues/04/01/BasicInstincts/>> Regards> Joyjit>> "jaYPee" <hi******@yahoo.com> wrote in message> news:0k********************************@4ax.com... >> I have a function that call a stored procedure which performs an>> insert command. now i want to refresh the dataset so that the newly>> inserted data will be available to my datagrid>>>> I have tried to call>>>> DsStudentCourse1.Tables("SchYrSemCourseJoin").Clea r()>> SqlDataAdapter3.Fill(DsStudentCourse1)>>>> However, the fill method causes a lot of time to process.>>>> anyone know what is the best way to fill/refresh the dataset again so>> that the newly inserted records will be available to my datagrid?>>>> thanks in advance.>>


Something went wrong it seems.

http://msdn.microsoft.com/library/de...iderEvents.asp

However just my thoughts,

Cor


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

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