SqlDataReader.GetChar ?? exist or not

  • Thread starter Thread starter MattB
  • Start date Start date
GetChar() exists because SqlDataReader implements IDataReader. You can even
see it in the Object Browser and it is "well" documented. However the .NET
Framework does not "really" implement it. Instead it throws an exception.
It seems the documentation guys and the developers have a disconnect.

The MSDN shows the following under the subject "Mapping .NET Framework Data
Provider Data Types to .NET Framework Data Types":

http://msdn.microsoft.com/library/d...aproviderdatatypestonetframeworkdatatypes.asp

Sql Server Type: char
..NET Framework Type: String or Char[]
..NET Framework typed accessor: GetString() or GetChars()
SqlType typed accessor: GetSqlString()

Don't ask me the reasoning behind not implementing GetChar().

HTH,
 
SqlDataReader.GetChar is not supported. It's an error in the docs. I filed a
bug so we fix the docs. Thanks for posting.

You can access char data by using GetString() or GetChars().

--
Pablo Castro
Program Manager - ADO.NET Team
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top