If the objects (TableAdapter/DataTable) are instantiated as local variables within a method (whether shared or not) then thread safety isn't an issue. Even if that method is called from multiple threads, each invocation of the method will have it's own instance
of the objects because they are local to the method; therefore there is no sharing across threads.
The thread safety issue comes into play if you have shared objects; that is, objects declared as shared globally, outside of the method. In this case you could have multiple threads accessing them.
Dave Sussman
All-Star
37716 Points
5005 Posts
ASPInsiders
MVP
Re: Thread safety using Shared Public methods for DB updates
Mar 20, 2012 09:05 AM|LINK
If the objects (TableAdapter/DataTable) are instantiated as local variables within a method (whether shared or not) then thread safety isn't an issue. Even if that method is called from multiple threads, each invocation of the method will have it's own instance of the objects because they are local to the method; therefore there is no sharing across threads.
The thread safety issue comes into play if you have shared objects; that is, objects declared as shared globally, outside of the method. In this case you could have multiple threads accessing them.