Ashok
Ashok

Reputation: 1906

Junk data in C# OracleDataAdapter

I am executing a query using OracleDataAdapter and taking the result into a DataSet in a C# application.

Below is code:

var da =new OracleDataAdapter("select login_id, session_key, ipaddress from
                              login_request_table where status='active'", ocon);
var ds = new DataSet();
da.Fill(ds);
foreach (DataRow drRow in ds.Tables[0].Rows)
 {
  var mLoginId = drRow["Login_id"].ToString();
  var session = drRow["session_key"].ToString();
  var ipadd = drRow["ipaddress"].ToString();
 }

When I executes this, first I confirmed any record in my Oracle table and result is:

Oracle query result

So as we can see there is no record in table for active status.

Now the hectic part:

When I debug the same query in Visual Studio, I am getting lots of records. Don't know why.

Any clue?

Upvotes: 0

Views: 78

Answers (1)

Some times the autocommit in Oracle, may be disabled. So, once the update has been done, you must do Commit if you run the queries through Backend. Try writing Commit after executing Update and check once.

Upvotes: 2

Related Questions