質問

DBテーブルの特定のフィールドが変更されたときに通知を取得する方法はありますか? .NET 4.0アプリでODP.NETとOracle 11gを使用しています。

後で編集:だから、答えから、私はそれが可能であると理解しているので、私は何かを試しました。こうやって :

        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);

問題は、マークされたようなものに閉じ込められ、60秒後にエラーをスローすることです。

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.

ありがとうございました!

役に立ちましたか?

解決

ODP.NETは、ADO.NET 2.0によって指定された変更通知を実装します。

ここには、簡単な説明といくつかのサンプルコードへのリンクがあります。

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top