Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cross thread error on DataTableAdapter.Update()

Status
Not open for further replies.

guttaboys

Programmer
Oct 28, 2003
17
NO
I have an easy client server application where the server handles clients with a new thread. I want to save some data from the client in a SQL server DB. Connection and inserts to DB are done with a DataTableAdapter and works fine when invoked from server. When I try to invoke the same method from the client thread I get a cross thread error.

Anyone who knows how to work around this?

 
client/server and threading are not directly related. you can take advantage of threading without client/server. you can use client/server architecture without multithreading.

if I'm not mistaken, multithreading is concerned with delegating work locally on box. Whereas client/server is about delegating work across multiple boxes.

There is information on the net about multithreading for a better user experience. BoundContext (or ContextBound, can't remember which) and BeginInvoke are 2 options for updating the UI from a background thread. this may be useful for you're scenario.

you may even be able to solve the cross threading issue using the BackroundWorker object. wire up a couple events, call DoWork() and the threading is handled for you.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top