Urgnet: help on OracleDataReader

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I tried to read fields that is varchar2(128) and value is encoded (oracle 8i iso DB). I used following

OracleDataReader myReader = oracleSelCommand.ExecuteReader()

after get back myReader, the value on field I need by using GetString() is wrong. GetBytes() or GetOracleBinary() will give invalid cast. How could I get the correct value

Thanks

Peter
 
Remember that with the DataReader the parameter is a zero-based index of the
column in the SELECT statement of your query. So, if the field you need is
the third column in the SELECT statement, the command would be
myReader.GetString(2)

However, if you are only getting a single value from a single row, the
better command method is ExecuteScalar, which returns a single object of the
first column and first row.

Hope that helps,
--
Marc Butenko
(e-mail address removed)



Peter said:
Hi:

I tried to read fields that is varchar2(128) and value is encoded (oracle 8i iso DB). I used following:

OracleDataReader myReader = oracleSelCommand.ExecuteReader();

after get back myReader, the value on field I need by using GetString() is
wrong. GetBytes() or GetOracleBinary() will give invalid cast. How could I
get the correct value?
 
Back
Top