473,508 Members | 2,158 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGridView DataTable(DataSet) and Thread safety

Hi,

I have a DataGridView, bounded to a DataTable which is populated/updated by
a OleDbDataAdapter (with OleDbConnection) to an Access Database. (Sounds
familiar to some of you ... I have posted a number of related questions
already.)

I want to have a worker thread starting to consume data from the DataTable.
Imagine that the DataTable contains a list of tasks. From the C# .NET
specification, DataTable "is safe for multithreaded read operations. You must
synchronize any write operations."

If the DataTable is managed programatically, e.g. not bound to a
DataGridView, the programming and testing shouldn't be too bad to create a
tread-safe application. However, my DataTable is bound to a DataGridView,
and I am concerned about the "random" updates made by the users. It's
probably wrong to assume any programatic/systematic behaviour by the users.

Is there a catch-all event between DataGridView and DataTable, such that I
can "lock" (or create a critical region) to control "Add", "Delete" and
"Update" to the DataTable? My worker thread will access the DataTable
directly, as programatic access to DataGridView is not allowed.

Or if anyone can advice me of any programming pattern for this type of set
up, I am all ears.

Thanks in advance.
--
George
Jun 19 '06 #1
1 3721
Hi George,

Thank you for posting.

I think when the BackgroundWorker is working, in order to prevent users
from adding, deleting or updating the data in the DataTable through the
DataGridView, you could disable the DataGridView.

You could set the Enabled property of the DataGridView to false before the
BackgroundWorker begins working and in the BackgroundWorker's
RunWorkerCompleted event handler set the DataGridView's Enabled property to
true.

Hope this helps.
If you have any other concerns, please don't hesitate to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support

================================================== ==
When responding to posts,please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ==

Jun 20 '06 #2

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

Similar topics

1
6802
by: Somebody_Out_There | last post by:
Hello, I am trying to create a strongly typed datatable/dataset from an untyped dataset or datatable returned from a stored proc. The structure of the table cannot be static since the results...
1
2841
by: Josh Golden | last post by:
i have a sqldatareader that could potentially pull in many rows, maybe thousands, and put them into a listBox on a windows form. i want to do it as fast as possible so right away i think about a...
3
2505
by: Datatable Dataset Datagrid help | last post by:
Hi I am somewhat confused, I am new at VB.net I use XML data, I have a datagrid, I created a datatable so that I can create a custom format like true is this graphic false is this graphic and...
1
1722
by: Navin Mishra | last post by:
Hi, I've multiple related data tables in a disconnected dataset which could be accessed by mutltiple threads to read and write data. The documentation says that dataset and datatable are thread...
2
2516
by: Aryan | last post by:
Hi, I am implementing Business object, but while implementing this I want to have DataTable or DataSet as part of Business Object. For example, I want to bind controls directly to these Business...
4
3591
by: Rainer Queck | last post by:
Hi NG, in my application a <myDataTable>.Select fails with "Syntax error in the expression." It took me a while, isolate the cause to this: To select some datarows from a data table I am...
5
1254
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have a Datatable/Dataset that I'd like to update back to the server. How do I go about saving changes to my Datatable or Dataset back to the database?
9
6954
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a routine that builds a table using different queries, different SQL Tables, and adding custom fields. It takes a while to run (20 - 45 seconds) so I wrote a thread to handle the table...
0
1560
by: jinksto | last post by:
Hi all, I have a datagridview that has the columns set up at design time. At run time I'm creating a dataset and would like to create columns in the dataset.table based on the columns already...
0
7326
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
7385
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...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.