[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

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?

Daniel

3/7/2007 11:13:00 PM

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?


1 Answer

Shan Plourde

3/8/2007 1:22:00 PM

0

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/9b1....
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/librar...(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


On Mar 7, 6:12 pm, "Daniel" <softwareengineer98...@yahoo.com> wrote:
> 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?