Dario Crivelli If you have an external source that notifies you of the changes in your data (as, in this case, a "row inserted" event), then the reception of the notification is the right place in which you can invoke "Update".
As you can see, in this case, you don't have to create your own threads, but you can just lean on the threads used by your external source to issue the notifications.
The only problem for you is to ensure that, if multiple rows are inserted at once, you will invoke Update once for each new row and in the same order.
In particular, if you have separated the data in three items, then what is important is that subsequent rows inserted for the same item give rise to invocations of Update in the same order.
Once you have ensured that, your client will receive the real-time updates correctly.
Okay never mind, i got this :d . By the way, please help me one more thing. I got the Run method below:
[B]public[/B][B]void[/B] [COLOR=#990000][B]Run[/B][/COLOR]()
{
go = [B]true[/B];
[COLOR=#445588][B]int[/B][/COLOR]c = [COLOR=#009999]0[/COLOR] ;
Random rand = [B]new[/B] Random();
[B]while[/B] (go) {
IDictionary eventData = [B]new[/B] Hashtable();
eventData [[COLOR=#DD1144]"message"[/COLOR]]= c % [COLOR=#009999]2[/COLOR] == [COLOR=#009999]0[/COLOR]? [COLOR=#DD1144]"Hello"[/COLOR] : [COLOR=#DD1144]"World"[/COLOR];
eventData [[COLOR=#DD1144]"timestamp"[/COLOR]]= DateTime.Now.ToString([COLOR=#DD1144]"s"[/COLOR] );
_listener.Update([COLOR=#DD1144]"greetings"[/COLOR], eventData, [B]false[/B]);
c++;
Thread.Sleep( [COLOR=#009999]1000[/COLOR]+ rand.Next([COLOR=#009999]2000[/COLOR] ));
}
}
How can i
pass some parameters to this method? Coz if i do that, i get stuck the code below
Thread t = [B]new[/B]Thread([B]new[/B] ThreadStart(Run));
t.Start();
I dont want to hard code like eventData["message"] or listener.update("greetings"). I want something like eventData[string] or listener.update(fieldname) (string and fieldname will be treated as arguments)
Thanks in advance