I have some code that uses ODP.Net
using (OracleConnection connection = new OracleConnection(connectionString))
{
connection.Open();
boxCommand = new OracleCommand(sql, connection);
OracleDataAdapter boxAdapter = new OracleDataAdapter(boxCommand);
DataTable boxTable = new DataTable();
boxAdapter.Fill(boxTable);
}
I then get an error below on a production server. The test server is fine.

I don’t understand as its complaining about a connection not being open but if there was a problem it should occur at the point my Open is called not on the Fill. Also I thought Fill was supposed to open the connection anyway.
Can anyone suggest what might be going on?
UPDATE: From the comments I tried adding this but same problem:
using (OracleConnection connection = new OracleConnection(connectionString))
{
connection.Open();
while(connection.State != ConnectionState.Open)
{
connection.Close();
connection.Open();
}
boxCommand = new OracleCommand(sql, connection);
OracleDataAdapter boxAdapter = new OracleDataAdapter(boxCommand);
DataTable boxTable = new DataTable();
boxAdapter.Fill(boxTable);
}
UPDATE 2 : I have added logging and the Validate Connection = true to the connection string and I know the connection state is open, the box command was done, the adapter created and the table created, it definitely errors on the Fill
Can you try installing the latest version of ODP.Net and see if you still have the problem? You should be able to run latest ODP.Net even against older Oracle DBs (10g in your case).
EDIT:
Since you’re restricted to a specific ODP.net version, here are some other things to try:
Make sure the proper Oracle folders are at the beginning of your system path. For example, I have the Oracle folders at the beginning of my path, like this (I have ODP.net installed in c:\oracle\ora11g and I also have Oracle 10g Express Edition installed, but note that the ODP.net folders are first:
c:\oracle\ora11g\product\11.1.0\client_1;c:\oracle\ora11g\product\11.1.0\client_1\bin;C:\oracle\ora10g\bin;
I’ve seen situations where Oracle does weird things and won’t work properly if the path isn’t correct.
Try reinstalling the specific ODP.net version you are using. This should clean things up and hopefully resolve your issue.