ODP.NET Getting Old Data

185 Views Asked by At

I am working with Oracle DB,C# and ODP.NET. I connecting to Oracle DB and getting datas, but i getting old data when updated data in table. Codes;

string conSTR = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 
1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORCPDB)))";
OracleConnection oracleCON = new OracleConnection() { ConnectionString = "Data Source=" + conSTR + ";User Id =XXXX;Password=XXXX;Pooling=True" };
        if (oracleCON.State == System.Data.ConnectionState.Closed)
            oracleCON.Open();
        tmr.Tick += delegate
        {
            try
            {                    
                OracleCommand command = new OracleCommand();
                command.Connection = oracleCON;
                command.CommandText = "SELECT state FROM CLX550";
                OracleDataReader dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    Btn1.Content = dataReader.GetInt16(0).ToString();
                }
                command.Dispose();
                dataReader.Close();
            }
            catch (Exception exc)
            {
                MessageBox.Show("ERROR\n" + exc.Message);
            }
        };
        tmr.Start();

For this example i getting state data "1" as int. After i update data (both ODP.NET or SQL Plus) to "0" but i getting old data, so it still "1". If I attempt get data in SQL Plus then it returns current data. What is the reason of this?

I am working PDB DB and synonym table. Oracle DB version 21c.

0

There are 0 best solutions below