Monday, March 19, 2012

.Read() not able to get data with special caracter

Hi all,

My SQL database has varchar that store names with special caracter like "René". The problem is when I try to get the data back from the database, the .Read() command from theSqlDataReader object is not working. In extra, it does not Throw any error????

Please help me,

JR

Use an nVarchar to store it|||

albertpascual:

Use an nVarchar to store it

That's not necessarily needed. With this example. "René" can be stored in and retrieved from a varchar column just fine.

JRG:

My SQL database has varchar that store names with special caracter like "René". The problem is when I try to get the data back from the database, the .Read() command from theSqlDataReader object is not working. In extra, it does not Throw any error????

First, and it's a silly question, so please bear with me. Are you *sure* it is stored in the database with the accented character? If it is, then I am guessing there *might* be an issue with the collation. Here's some introductory information regarding collation which may or may not help:SQL Server and Collation.

|||

Thanks all...

I found the problem minutes after posting... the problem was coming from the Gridview... I desable HTML encoded and it worked, but this was really strange because I tested where the code was crashing by putting code like Label1.Text = "here1";... and it was crashing when excuting .Read()?

Thanks,

JR

No comments:

Post a Comment