When opening an oracle connection, connection object is null

后端 未结 5 2097
予麋鹿
予麋鹿 2020-12-19 10:08

I am trying to connect to an oracle database in my controller:

 using Oracle.DataAccess.Client;
 using Oracle.DataAccess.Types;

 // Other code

 OracleConne         


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-19 10:29

    I think there's an over-reaching try somewhere, or the stack makes me think this is an async controller call, but you're not using the async methods ("async all the way").

    Explanation:

    Something else is going on here. While I'm glad suggestions for a try/catch block helped you resolve the issue, they should not have been required with the simplified code bock - the ora exception should have been thrown in place of the null reference exception.

提交回复
热议问题