这是我写的一个测试代码,发现我如果注册了一个变更通知,却不能取消他,即使我刚注册就去取消,也会有异常。这个问题弄得我头大。大家帮忙想想办法吧。  
         
            //创建链接。
            OracleConnection conn = new OracleConnection("User Id= ;Password= *******;Data Source= test003");
            conn.Open();            //生成command.添加回调函数。
            OracleCommand command = new OracleCommand("select * from wcfdemo",conn);            //这里我想永久注册这个更改通知,直到我调用RemoveRegistration
            OracleDependency odp = new OracleDependency(command,false,0, false);
            odp.OnChange += new OnChangeEventHandler(myFunc);
            
            //执行命令。同时注册这个更改通知。
            command.ExecuteNonQuery();            //去掉这个注册。问题就在这里。老是抛出这个异常:ORA-24950: unregister failed, registeration not found
             odp.RemoveRegistration(conn);    
            conn.Dispose(); 

解决方案 »

  1.   

    removeRegistration(Registration registration) 
                
    removeRegistration(java.lang.String registrationHandle)  
    odp.RemoveRegistration(conn);     //你调用的是connection ,抛出ORA-24950的异常再看错误 ORA-24950 unregister failed, registeration not foundCause: The registeration that was asked to be unregistered could not be found.Action: Check the callback function name and the subscription name in the unregister call.