What is the difference between DataReader.GetValue() and DataReader[Column_Name]?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • usha535140
    New Member
    • Dec 2009
    • 6

    What is the difference between DataReader.GetValue() and DataReader[Column_Name]?

    Hi All,
    What is the Difference between DataReader[ColumnName] and DataReader.GetV alue() .

    I have one Sp which returns an out param and one cursor .while reading the first outparam by using dataReader[column_Name] it is throwing exception ,but with the help of DataReader.GetV alue(0) am able to read this value.
    What I believe is I should not get exception in first case also.
    can someone clarify me y do we need to use GeValue(0) in case of single Parameter.

    If I acess through dataReader[Param-Name] it is throwing Exception as "System.IndexOu tOfRange Exception".
    Last edited by usha535140; Nov 1 '10, 07:24 AM. Reason: to Add Exception Details
Working...