Aysnchronous fill

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
maxcpr
Posts: 33
Joined: Wed 10 Dec 2008 14:46

Aysnchronous fill

Post by maxcpr » Tue 26 Jan 2010 12:45

Hi

I have problems with understanding how async fill works.

I use BeginFill, SuspendFill & EndFill methods expected what they work as follow:

BeginFill(AsyncCallbackEndFill, null) - begins to fill table asynchronously.

When SuspendFill() is invoked - dataTable stops to fill and AsyncCallbackEndFill is called.

EndFill() - fetchs all selected results to DataTable.

But there is one subtle notion:

When current fill operation was interrupted by SuspendFill() and then BeginFill is invoked next time - preeceeded fill query continue to execute on server. Consider example:

Suppose datatable has 1000 rows.

Code: Select all


IAsyncResult res = this.dataSet1.CLIENT.BeginFill(null,null);

System.Threading.Thread.Sleep(5000);

this.dataSet1.CLIENT.SuspendFill(true);

this.dataSet1.CLIENT.EndFill(res);

Diagnostics.Debug.WriteLine(this.dataSet1.CLIENT.Rows.Count);

this.dataSet1.CLIENT.Clear();

//this.dataSet1.CLIENT.SelectCommand.CommandText = " CLASSIFIED IS NULL "

res = this.dataSet1.CLIENT.BeginFill(null, null);

res.AsyncWaitHandle.WaitOne();

Diagnostics.Debug.WriteLine(this.dataSet1.CLIENT.Rows.Count);

Result :
200
800

This show how things actually works. Even if row what change query condition was uncommented the result will the same.

How i can change this behaviour. And cancel Fill operation at all?
[/code]

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Tue 26 Jan 2010 17:59

You can call the CancelFetch method after SuspendFill(). It will stop the current fill operation and the next BeginFill call will start fetching data from beginning.

maxcpr
Posts: 33
Joined: Wed 10 Dec 2008 14:46

Post by maxcpr » Wed 27 Jan 2010 06:18

Very THANK :!: But you should mention it in documentation i suppose.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Wed 27 Jan 2010 12:47

We will add to the documentation the description of this scenario (BeginFill -> SuspendFill -> EndFill -> BeginFill).

Post Reply