SqlDataReader.GetChar(n) failed because of Specified method unsupp

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,

I just set up my VStudio 2003 and tried to run a test of reading a character
from database by using SqlDataReader.GetChar, but it failed. I got the
following error message
-----------------------------------------------------------------------------------------------
An unhandled exception of type 'System.NotSupportedException' occurred in
system.data.dll

Additional information: Specified method is not supported.
-----------------------------------------------------------------------------------------------
The real value in the table is 'N'.

Any one knows what happened? I am new to .Net. Is my system.data.dll too old?


I checked the dll file located at
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 and its version is 1.1.4322.2032.

Thanks for your help.

Daniel Huang
 
GetChar is not supported on SqlDataReader, it is present only because
IDataReader forces you to implement it.

I know the MSDN documentation doesn't say so .. but methinks this is true
:-/

As a matter of fact, VS2005, doesn't even show it in intellisense, but the
code compiles just fine. WEIRD !! Anyway .. now u know why ..
- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 
Thanks.

I realized that that method is not implemented but just throws a
System.NotSupportedException. The VStudio does not provide this method when I
coded it. The MSDN library misled me because it does not state so. And
VStudio Arthitect 2003 (the verios I am using) is not smart enough to warn me
this unimplemented method.

Daniel Huang
 
Do you know if there is another method (way) to retrieve the a value from a
single character column or I have to use GetString?

Thanks again.

Daniel Huang
 
Back
Top