laled
9/28/2002 1:48:00 AM
The correct way to read the column names is through the
reader.GetName method. Try using
m_Rdr.GetName( lIndex)
to read the column names.
Thanx
Lale
This posting is provided "AS IS" with no warranties, and
confers no rights.
>-----Original Message-----
>> Could you show a short example of the code that's
failing to
>retrieve
>> column names?
>>
>
>//... BEGIN CODE EXAMPLE ...
>
>OdbcConnection lConn = new OdbcConnection( m_SwlStr );
>lConn.Open();
>
>m_Cmd = new OdbcCommand( "Select # FROM \"Sheet1$\"",
lConn );
>m_Rdr = m_Cmd.ExecuteReader();
>
>// Here is where I read the columns ....
>//
>for( lIndex = 0; lIndex < m_Rdr.FieldCount; lIndex++ )
>{
> Trace.WriteLine( m_Rdr.GetValue( lIndex).ToString
() );
>}
>
>// END CODE EXAMPLE ...
>
>The 'GetValue' method should do an automatic conversion
of the
>underlying type and return a string. In fact what
happens is
>that the data returns as I expected, but the column names
of
>'non' string types return null.
>
>The problem must be in the ODBC.NET piece as the
equivalent C++
>code calling the same ODBC driver returns the column
names as
>expected.
>
>I hope this clarifies the problem.
>
>Thanks,
>
>Carl Huff
>
>
>
>.
>