In this post we are exploring more about OracleDataReader class.We
use an object of the OracleDataReader class to read rows retrieved from a
Oracle database.
Data reader objects only allow we to access rows one after another
from beginning to end. For this reason, these objects aren’t the most flexible
when accessing rows, but they do offer the fastest access to the rows stored in
them. If we don’t need flexible access to rows, we might want to consider using
a data reader object.
The OracleDataReader supports the following Properties (this is not a
complete list):
Sr.No
|
Property
|
Type
|
Description
|
1)
|
Depth
|
int
|
Gets a value indicating the depth of nesting for the current row.
|
2)
|
FieldCount
|
int
|
Gets the number of columns in the current row.
|
3)
|
IsClosed
|
bool
|
Gets a bool value indicating whether the data reader is closed.
|
4)
|
RecordsAffected
|
int
|
Gets the number of rows added, modified, or removed by execution of the SQL statement.
|
The OracleDataReader supports the following Methods (this is not a complete
list):
Sr.No
|
Method
|
Return Type
|
Description
|
1)
|
GetBoolean()
|
bool
|
Returns the value of the specified column as a bool.
|
2)
|
GetByte()
|
byte
|
Returns the value of the specified column as a byte.
|
3)
|
GetBytes()
|
long
|
Reads a stream of byte values from the specified column into a byte array. The long
value returned is the number of byte values read from the column.
|
4)
|
GetChar()
|
char
|
Returns the value of the specified column as a char
|
5)
|
GetChars()
|
long
|
Reads a stream of char values from the specified column into a char array. The long
value returned is the number of char values read from the column.
|
6)
|
GetDataTypeName()
|
string
|
Returns the name of the source data type for the specified column.
|
7)
|
GetDateTime()
|
DateTime
|
Returns the value of the specified column as a DateTime.
|
8)
|
GetDecimal()
|
decimal
|
Returns the value of the specified column as a decimal.
|
9)
|
GetDouble()
|
double
|
Returns the value of the specified column as a double.
|
10)
|
GetFieldType()
|
Type
|
Returns the Type of the specified column.
|
11)
|
GetFloat()
|
float
|
Returns the value of the specified column as a float.
|
12)
|
GetGuid()
|
Guid
|
Returns the value of the specified column as a globally unique identifier (GUID).
|
13)
|
GetInt16()
|
short
|
Returns the value of the specified column as a short.
|
14)
|
GetInt32()
|
int
|
Returns the value of the specified column as an int.
|
15)
|
GetInt64()
|
long
|
Returns the value of the specified column as a long.
|
16)
|
GetName()
|
string
|
Returns the name of the specified column.
|
17)
|
GetOrdinal()
|
int
|
Returns the numeric position, or ordinal, of the specified column (first column
has an ordinal of 0).
|
18)
|
GetSchemaTable()
|
DataTable
|
Returns a DataTable that contains details of the columns stored in the data reader.
|
No comments:
Post a Comment
Please do not enter any spam link in the comment box.