我想获得一个winform应用程序,刷新使用Oracle 10g数据库更改的嵌入式浏览器。唯一的问题是,我不能使用数据库更改通知。我很好奇,如果任何人有使用内置的包装DBMS_ALERT的一种方式,并已经取得了一些行动发生在一个winform应用程序对数据库的变化。
I am trying to get a winform app to refresh an embedded browser on a database change using Oracle 10g. The only problem is that I am not allowed to use Database Change Notification. I am curious if anyone has a way of using the built-in package of DBMS_Alert and have had some action happen to a winform app on a database change.
谢谢,安德鲁
我不得不做这样为它工作。它拥有的窗口锁,直到发生的事件,我知道,但至少它的工作原理与DBMS_ALERT。我设置code定时器里:
I had to do it like this for it to work. It holds the window in lock until an event occurs i know, but at least it works with DBMS_Alert. I set this code inside a timer:
为OracleConnection康恩=新的OracleConnection(的ConnectionString); conn.Open(); 的OracleCommand CMD =:新的OracleCommand(声明\ N+ 消息VARCHAR2(1800):= NULL; \ N+ 状态整数; \ N+ BEGIN \ N+ DBMS_ALERT.REGISTER(ALERT); \ N+ DBMS_ALERT.WAITONE(ALERT,消息状态); \ N+ DBMS_ALERT.REMOVE(ALERT); \ N+ END;,conn);在 cmd.ExecuteNonQuery(); wbMain.Refresh(); conn.Dispose();
OracleConnection conn = new OracleConnection(ConnectionString); conn.Open(); OracleCommand cmd = new OracleCommand("DECLARE\n" + "MESSAGE VARCHAR2(1800) := null;\n" + "STATUS INTEGER;\n" + "BEGIN\n" + "DBMS_ALERT.REGISTER('ALERT');\n" + "DBMS_ALERT.WAITONE('ALERT', MESSAGE, STATUS);\n" + "DBMS_ALERT.REMOVE('ALERT');\n" + "END;", conn); cmd.ExecuteNonQuery(); wbMain.Refresh(); conn.Dispose();
这给了我我需要什么。我不知道是否有更好的方式来做到这一点,但是这是我能想出的唯一解决方案。
This gives me what I need. I don't know if there is a better way to do it, but this is the only solution I could come up with.