I have a client/server app using a remoting object that is intended to share a single datatable with multiple clients. The remoting object is as follows:
Public Class RemConnect
Public Shared dtAll As DataTable
Shared Sub New()
If dtAll Is Nothing Then dtAll = New DataTable
Public Shared Property GetTable() As DataTable
Set(ByVal Value As DataTable)
dtAll = Value.Copy
Then I have a host app that registers the tcp channel and service, executes a SQL query, and fills dtAll. The clients open a channel on the same port (I listed WellKnown entries at each client and they can "see" the remote object correctly). When any of my clients connect, dtAll appears to be empty. If I add the code to run the query from a client, fill dtAll, then bind the client datagrid to dtAll, I see the data correctly on the client that ran the query, but the other client still sees dtAll as "nothing." I'm not creating a new instance of the remoting object for each call from the client (that is, I'm using "RemConnect.GetTable" rather than Dim RC as new RemConnect, RC.GetTable), so I thought that it would just use an active instance of the object on the server.
Any help on the proper way to share the datatable so that it retains it's data across all instances of the class? Or am I going at this all wrong for what I'm trying to accomplish? Thanks in advance for any suggestions.