reza rostami
reza rostami

Reputation: 93

ORA-24338: statement handle not executed (not executed)

This code connect to oracle but not execute query.
I install Oracle Developer Tools for Visual Studio .NET. And check code is true. And Oracle.DataAccess.dll. And It works query in sql developer. And everything code is true but not execute statement . help me.

bool result = false;
string connst =System.Configuration.ConfigurationSettings.AppSettings["OISCS"];
Console.Write(connst);
OleDbConnection dbConn = new OleDbConnection();
dbConn.ConnectionString = connst;

OleDbCommand dbCom = new OleDbCommand(" SELECT * FROM OIS.USERINFo WHERE  USERID= '" + UserID + "';", dbConn);

dbCom.CommandType = System.Data.CommandType.Text;
dbCom.CommandTimeout = 30;

try
{
       dbConn.Open();
        OleDbDataReader dbReader = (OleDbDataReader)dbCom.ExecuteReader();
       dbReader.Read();
 }
 catch (Exception e)
 {               
        throw e;
 }
 return result;

Upvotes: 1

Views: 4020

Answers (1)

Ronald Wildenberg
Ronald Wildenberg

Reputation: 32134

You should change the lines where you initialize the dbReader:

OleDbDataReader dbReader = (OleDbDataReader) dbCom.ExecuteReader();

The code you have now throws a NullReferenceException because you never initialize dbReader.

UPDATE: Now that the question is updated, this should no longer be the case...

Upvotes: 1

Related Questions