// Perfume bad AT 06-07-25
// Depressing things always keep going. The invisible pressure comes from the fear.
When we use. net for data operations, we have a lot of contact with DataReader.
System. Data. OleDb. OleDbDataReader;
System. Data. Odbc. OdbcDataReader;
System. Data. SqlClient. SqlDataReader;
Inherit from
System. externalbyrefobject; // allow objects to be accessed across application domain boundaries in applications that support remote processing.
System. Collections. IEnumerable;
System. Data. IDataReader;
Inherit from
System. Data. IDataRecord;
System. IDisposable;
// IDataReader defines the value of a row of records, the common method of field names, and the attribute interface such as: object this [string name] {get ;}; object this [int I] {get ;}
The following describes in detail the attributes of this [string name] And this [int I] (we believe that this attribute is frequently called)
I think there are many attributes that you can see when using NameValueCollection. Otherwise, they are completely different concepts.
In fact, this [string name] is a convenient operation of this [int I ].
First, you can use the GetOrdinal method in this [string name] to obtain the index of the field name, and then call the GetValue method to obtain the value.
It can be seen that calling this [int I] is much more efficient than calling this [string name ]. *-*
The GetOrdinal method uses the GetName method to compare all column field names. If no index number is returned, an exception is thrown.
// You have time to make up for it today (the network was disconnected yesterday, and it was sent again today)