Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / March 2007

Tip: Looking for answers? Try searching our database.

how does ado.net SqlDataReader.GetString() know which encoding to read the data into a string as? Does sql sever set this at the column data type level, server wide encoding setting, os encoding?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 07 Mar 2007 23:12 GMT
how does ado.net SqlDataReader.GetString() know which encoding to read the
data into a string as? Does sql sever set this at the column data type
level, server wide encoding setting, os encoding?
Shan Plourde - 08 Mar 2007 13:21 GMT
Hi Daniel, the .NET framework uses UTF-16 to represent characters,
although it uses UTF-8 internally some cases. See
http://msdn2.microsoft.com/en-us/library/9b1s4yhz.aspx.
SQL Server manages encoding as well at the database instance,
database, table and column levels - you can find more details about it
at http://msdn2.microsoft.com/en-us/library/aa174903(SQL.80).aspx. But
this is only applicable to column types that are not unicode (varchar,
char, etc).

I have always assumed that the encoding the .NET reads strings with is
the default UTF-16 and that it automatically converts database strings
into this format when it retrieves them. But I would suspect that the
format of database data is converted to some variant of Unicode before
it even gets to the .NET API that we would use to read the value.
Shan

> how does ado.net SqlDataReader.GetString() know which encoding to read the
> data into a string as? Does sql sever set this at the column data type
> level, server wide encoding setting, os encoding?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.