locked
Accented characters not saving correctly in database. RRS feed

  • Question

  • User-614497913 posted

    Hi there, 

    We are using a .NET content management system called Ektron.

    There is a control within the content management system that stores a Rating and Comment about a piece of content.The problem is that the comment does not save Accented characters correctly, eg - á é í ú ó etc

    I've found the table in the database, and if I write to it directly using a SQL UPDATE statement in SQL Management Studio the correct value is stored - the field is of nvarchar data type so there shouldn't be a problem.

    Where along the way could the ASP.NET application / IIS not be recognising the character correctly?

    Thanks for any help

     

    Friday, May 1, 2009 6:59 AM

Answers

  • User-501974848 posted

    Please check the following code block to insert unicode data:
    SqlConnection sqlConnection = myconnString;
    string command = "Insert into Table(YourColumnName) values(@YourParameter)";
    SqlParameter YourParam = new SqlParameter("@YourParameter", SqlDBType.NVarchar,300);
    YourParam.Value = "YourNVarcharValue";
    SqlCommand sqlCommand = new SqlCommand(command, sqlConnection);
    sqlCommand.Parameters.Add(YourParam);
    sqlConnection.Open();
    sqlCommand.ExecuteNonQuery();

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 1, 2009 9:06 AM

All replies

  • User-501974848 posted

    Please check the following code block to insert unicode data:
    SqlConnection sqlConnection = myconnString;
    string command = "Insert into Table(YourColumnName) values(@YourParameter)";
    SqlParameter YourParam = new SqlParameter("@YourParameter", SqlDBType.NVarchar,300);
    YourParam.Value = "YourNVarcharValue";
    SqlCommand sqlCommand = new SqlCommand(command, sqlConnection);
    sqlCommand.Parameters.Add(YourParam);
    sqlConnection.Open();
    sqlCommand.ExecuteNonQuery();

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 1, 2009 9:06 AM
  • User-614497913 posted

    Thanks for your post OM - I'm a little confused about what this is trying to achieve though?

    As I stated, we are using a Content Management System, and 1 of the controls in this CMS is writing accented characters incorrectly to the database.

    Tuesday, May 5, 2009 6:58 AM
  • User-501974848 posted

    Hi,
    The above code displays how to pass/save  unicode data /accented characters in database.
    The column in database should be NVARCHAR to support this.

    Tuesday, May 5, 2009 7:00 AM
  • User-614497913 posted
    Thanks Om but I don't think you read the original post correctly. We are using a Content Management System, and 1 of it's controls is saving the text to the database. The control is compiled as part of the Content Management System. The database field is NVARCHAR
    Tuesday, May 5, 2009 8:39 AM
  • User-501974848 posted

    Then probably you need to check the documentation for this.

    Or you need to post query in the ektron forum.
    http://dev.ektron.com/forum.aspx

    Please check the following post for similar issue:
    http://dev.ektron.com/forum.aspx?g=posts&t=23458

    Tuesday, May 5, 2009 9:20 AM
  • User-614497913 posted

    Thanks again Om - I have a support case open with Ektron and have also post to that forum, but haven't had a resolution yet. The support person who replied to the forum post said that her test site using the ContentReview control saves the accented characters correctly.

    This would lead me to believe that it's not the control itself, but rather a configuration issue with either ASP.NET - IIS - SQL Server 2005

    Thanks

    Neal

    Tuesday, May 5, 2009 9:50 AM