Question

Y at-il un moyen d'obtenir une notification quand un certain champ dans une table db est modifiée? J'utilise ODP.NET et Oracle 11g, sur une application .NET 4.0.

PLUS TARD EDIT: Ainsi, des réponses que je comprends qu'il serait possible, donc je l'ai essayé quelque chose. Voici comment:

        OracleConnection con = new OracleConnection(constr);
        OracleCommand cmd = new OracleCommand(sql, con);
        con.Open();

        cmd.AddRowid = true;

        **OracleDependency dep = new OracleDependency(cmd);**

        cmd.Notification.IsNotifiedOnce = false;

        dep.OnChange += new OnChangeEventHandler(OnMyNotification);

        OracleDataAdapter da = new OracleDataAdapter();
        da.SelectCommand = cmd;
        da.Fill(ds, tablename);

        ultraGrid1.SetDataBinding(ds, tablename);

Le problème est que si elle se bloque à la marque comme et après 60 secondes, il renvoie une erreur:

The CLR has been unable to transition from COM context 0x25f638 to COM context 0x25f7a8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

Merci!

Était-ce utile?

La solution

ODP.Net n'implémente la notification Un changement qui est spécifié par ADO.Net 2.0.

Il y a une brève description et un lien à un exemple de code ici:

http://www.oracle.com/technetwork/issue- archives / win06odp-099708.html

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top