0

I have created a stored procedure as follows:

CREATE PROCEDURE spIns_nav_Content
  @CategoryID nVarChar(50),
  @ContentText nVarChar(Max)
AS
  INSERT INTO dbo.nav_Content(CategoryID, ContentText, Active)
  VALUES (@CategoryID, @ContentText, 1)

In my ASP.net application I have a textbox and a button. My aspx page looks like this:

<div>
  <asp:Label ID="Label1" runat="server" Text="Text here"></asp:Label>
  <asp:TextBox ID="txtContent" runat="server" Font-Names="ML-TTKarthika"></asp:TextBox>
  <asp:Button ID="btnUpload" runat="server" Text="Upload" onclick="btnUpload_Click" />
  <asp:Label ID="lblContent" runat="server" Font-Names="ML-TTKarthika"></asp:Label>
</div>

When clicked on btnUpload I need to save the non-English (Malayalam) text in txtContent to database as unicode characters. The click event is as follows:

protected void btnUpload_Click(object sender, EventArgs e) {
  string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["TestMalayalamConnectionString"].ConnectionString;
  SqlConnection con = new SqlConnection(connectionString);
  con.Open();
  SqlCommand sqlCmd = con.CreateCommand();
  sqlCmd.CommandType = CommandType.StoredProcedure;
  sqlCmd.CommandText = "spIns_nav_Content";
  sqlCmd.Parameters.Add("@CategoryID", SqlDbType.NVarChar, 50).Value = "Rashriyam";
  sqlCmd.Parameters.Add("@ContentText", SqlDbType.NVarChar, -1).Value = txtContent.Text;
  sqlCmd.ExecuteScalar();
  con.Close();
  lblContent.Text = txtContent.Text;
}

When I see my db table the value in ContentText is in English. How can I change this?

1 Answer 1

1

What's the purpose of the font?

If it's mapping english characters to a foreign character set for display purposes (which as far as I can tell it does), then the DB is going to store english characters, as they are what is being typed in.

I typed hello into a font preview and could see that there were two characters the same for the letter l, then the o.

Effectively, all you are doing is substituting the typed english characters for the foreign character set at display time only. The underlying characters are still english.

To store Unicode characters, you'd have to actual enter unicode characters into the input control.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.