次のようにストアドプロシージャを作成しました。
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
は英語です。どうすればこれを変更できますか?