Acessing a field in an OleDbDataReader

  • Thread starter Thread starter Bisley
  • Start date Start date
B

Bisley

I have an OleDbDataReader that gets created based on the following
(simplified) SQL

select table1.field1, table2.field2 f
from table1, table2
where ......

on my development machine, the following line works fine.

myOleDbDataReader.GetString(myOleDbDataReader.GetOrdinal("field1"));

However, on my colleagues machine this throws an exception, and the line has
to be modified to

myOleDbDataReader.GetString(myOleDbDataReader.GetOrdinal("table1.field1"));

The database drivers are the same version, same version of .NET, same
version of MDAC...etc

TIA

Bisley
 
Hi Bisley,

Strange.
Try looping through all columns (0..FieldCount-1) and output
GetName(column_index) somewhere to see what column names are returned.
 
Back
Top