0

次のようにストアドプロシージャを作成しました。

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

ASP.netアプリケーションには、テキストボックスとボタンがあります。私のaspxページは次のようになります。

<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>

クリックするbtnUploadと、英語以外(マラヤーラム語)のテキストtxtContentをUnicode文字としてデータベースに保存する必要があります。クリックイベントは次のとおりです。

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;
}

私のdbテーブルを見ると、の値ContentTextは英語です。どうすればこれを変更できますか?

4

1 に答える 1

1

フォントの目的は何ですか?

表示目的で英語の文字を外国の文字セットにマッピングしている場合(私が知る限り)、DBは入力されているものであるため、英語の文字を保存します。

フォント プレビューに入力helloしたところ、2 つの文字が同じ文字であることがわかりl、次にo.

事実上、表示時に外国語の文字セットを入力した英語の文字に置き換えるだけです。基になる文字はまだ英語です。

Unicode 文字を保存するには、入力コントロールに実際に Unicode 文字を入力する必要があります。

于 2012-12-27T12:20:08.523 に答える