System.Data.SqlClient clarify SqlDataReader get char
See original GitHub issueSql Server doesn’t have an individual char datatype and in desktop .net the SqlDataReader.GetChar
is marked as not browsable and implemented as a NotSupportedException
. The version in this repository lacks the browsable attribute (in src and ref) and I think it should be re-added.
The documentation for SqlDataReader.GetFieldValue<T>
lists char as one of the permitted types but it will not work, there is no metadata support or way to get a char from the database. This means it will always throw an InvalidCastException
and I believe it should throw NotSupportedException
where T is char to align with GetChar
. This would be a behaviour change and need adding to the documentation.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
SqlDataReader GetChar(int index) method
Because SqlDataReader implements IDataReader , it has a GetChar() method. ... SqlDataReader reader, int columnIndex) { System.Data.SqlTypes.
Read more >SqlDataReader.GetChars(Int32, Int64, Char ...
Reads a stream of characters from the specified column offset into the buffer as an array starting at the given buffer offset.
Read more >SqlDataReader.GetChar(Int32) Method
Gets the value of the specified column as a single character.
Read more >ADO.NET SqlDataReader in C# with Example
The ADO.NET SqlDataReader class in C# is used to read data from the SQL Server database in the most efficient manner. It reads...
Read more >ADO.NET Interview Questions And Answers
System.Data.SqlClient, Contains the classes that are used to ... GetChar will return a column value as a character and GetString as a string ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If you’ve checked and I hid it but didn’t close this issue then it’s closable now.
Thanks @Wraith2 for confirming, we’ll close this thread then.