I have read this post, I have followed Chris answer but it's still returning me this error. I have googled the error but could not find much solution to this error related to this error and those having the quite similar error as me points towards Chris solution. Does anyone knows what causes this error upon connecting to the oracle DB. Most of the errors are DataAccess.dll having different versions problem but mine is Object reference not set to an instance.
Well, however the problem here is that on my XE Client (11.2.0), I could run without any issue using my developing environment, there is no issue from the start on my side before I deploy to another environment. I did not even need to go through Chris solution. The Oracle.DataAccess.dll I tried both version 10.2.0.100 / 2.112.2.0 and they are working on my development side. However when it's put on the another environment (11g XE) there's an exception occurred upon .Open() and Chris solution doesn't help. Probably it's different issue here.
Also, I have connect in my main method and it has no issue. However this exception only occurs when it's connecting through my function. And I'm using the same connection for both my main and function. However I don't think the issue here is coding issue as I am able to run perfectly on my own environment.
It's running on my own environment, UAT environment but when brought onto production environment this error happens.
Dim OraconnString As String
OraconnString = ConfigurationManager.ConnectionStrings("OraConnectionString").ConnectionString
Dim OraConn As New OracleConnection(OraconnString)
Dim oracommand As OracleCommand
Dim oraadapter As New OracleDataAdapter
OraConn.Open()
I am getting this exception error upon .Open() method
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at Oracle.DataAccess.Client.OracleInit.GetDllDirectory(String version)
at Oracle.DataAccess.Client.OracleInit.Initialize()
at Oracle.DataAccess.Client.OracleConnection..ctor(String connectionString)
at WindowsApplication1.UpdateInv.UpdateInv_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/********/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/******/*****/GAC_MSIL/Microsoft.VisualBasic/****/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/******/****/GAC_MSIL/System/2.0.0.0__*******/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/********/******/GAC_MSIL/System.Windows.Forms/2.0.0.0__*********/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/********/********/GAC_MSIL/System.Drawing/2.0.0.0__********/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/********/********/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__********/System.Runtime.Remoting.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/********/********/GAC_MSIL/System.Xml/2.0.0.0__********/System.Xml.dll
----------------------------------------
Oracle.DataAccess
Assembly Version: 10.2.0.100
Win32 Version: 10.2.0.100
CodeBase: file:///C:/********/********/GAC/Oracle.DataAccess/10.2.0.100__********/Oracle.DataAccess.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/********/********/GAC_32/System.Data/2.0.0.0__********/System.Data.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/****/*****/GAC_MSIL/System.Configuration/2.0.0.0__********/System.Configuration.dll
----------------------------------------
Does anyone has any idea what is causing the issue or any solution to this issue?