473,385 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Fill DS in thread

I have a long running query. I want the results in a DataGrid. I'd like
the grid and form to be responsive and fill up w/ rows as the result
set is read into a dataset that is the datasource of the grid.

Possible?
If so, how should the thread handle updating the grid's datasource and
have the grid reflect the changes w/o waiting till the thread finishes?

Any example would be greatly appreciated.
Thanks.

Nov 17 '05 #1
2 1757
Hi,

In this case, you will most likely need to fill the DataSet manually from a
DataReader. Do this filling on the worker thread, and invoke an Update
method on the UI thread periodically by using Control.Invoke(). The Update
method will be re-binding the grid to the updated datasource. You must also
ensure that the datasource does not raise any events itself when it is being
modified on the worker thread. Otherwise, the grid might try to act upon
these events, and as soon as they are being raised on a non-UI thread, you
might get a nasty exception.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]

<wa********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have a long running query. I want the results in a DataGrid. I'd like
the grid and form to be responsive and fill up w/ rows as the result
set is read into a dataset that is the datasource of the grid.

Possible?
If so, how should the thread handle updating the grid's datasource and
have the grid reflect the changes w/o waiting till the thread finishes?

Any example would be greatly appreciated.
Thanks.


Nov 17 '05 #2
Would that cause the position in the Grid to be reset everytime the
datasource was updated? I'd like to avoid that.

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ali poursadri | last post by:
Hi, I want to fill my list box from a dataset in c#. I use adapter and fill command and bind it to a listbox, but it is very slow for large data about 500000 records. How can I view this list...
0
by: Abra | last post by:
Is it possible to fill a ADO.NET dataset incrementally ? (I mean to call the DataAdapter Fill() method several times, as I did not found a Add() method) I would like to call in a background thread...
0
by: Bil Muh | last post by:
Hello Developers, I would like to fill a data grid on my "Windows Forms (.NET)" by a background thread. I read some data from a binary file. With the information read from this file, I create...
30
by: Raymond Hettinger | last post by:
Proposal -------- I am gathering data to evaluate a request for an alternate version of itertools.izip() with a None fill-in feature like that for the built-in map() function: >>> map(None,...
0
by: dalaeth | last post by:
I have searched Google high and low and haven't found anything that works. Here's my problem, hopefully someone will be able to help! I'm using 1.1 Framework, and ODP.NET 9.5.0.7 on a Windows...
2
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
The auto-generated line of code to fill a DataGridView once it is placed on the designer surface in VS2005 is typically: this.xyzTableAdapter.Fill(this.myDataSet.MyMember); But if the query...
8
by: cj | last post by:
I have a 2003 program that opens a foxpro table via odbc and loads in the data into a dataset. I copied the code into a 2005 program after a long wait it fails with the error ...
1
by: Marcolino | last post by:
Hi all, I'm using this code to export entire table from access to xml file. DScmdXML = New OleDb.OleDbCommand(sqlXML, conn) DScmdXML = New OleDb.OleDbDataAdapter(cmdXML) DScmdXML.Fill(DSXML,...
6
by: akshaycjoshi | last post by:
I have one datagridview which i fill using the connected verion of ADO.NET. When the user presses the search button a seperate thread is created and in that thead i connect to the database and fill...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.