ASp.net Web开发 [英] ASp.net Web development

查看:55
本文介绍了ASp.net Web开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友我正在尝试开发一个仪表板,其中管理员将在印地文中输入一些内容,这将插入数据库中的印地文,但这不起作用,因为我已经在sql server中采用数据类型nvarchar并在我的机器中安装了krutidev将文本框字体设置为Krutidev。



上面这样做我要在文本框中键入hindi但数据没有插入hindi我的sql查询是insert int mytable (hindinews)值(N'+ txt_hindi.Text +')







求助我

Hello frnds i am trying to develop a dashboard where admin will type some content in hindi and this will insert in database in hindi but this not working as i have taken datatype nvarchar in sql server and have installed krutidev in my machine and also have set textbox font as Krutidev.

Doing this above i am getting to type in hindi in textbox but data is not inserted in hindi my sql query is "insert int mytable (hindinews) values(N'"+txt_hindi.Text+"')"



Plese help me

推荐答案

Create table Test_Lang

(strText nvarchar(max))





插入Test_Lang(strText)值(N'+ txt_hindi.Text +')



Insert into Test_Lang(strText) values(N'"+txt_hindi.Text+"')


但我想从文本框中插入


尝试完美工作



aspx页面:





Try it working perfectly

aspx page:


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ex.aspx.cs" Inherits="ex" %>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
       <script src="https://www.google.com/jsapi" type="text/javascript">
    </script>
    <script type="text/javascript" language="javascript">
        google.load("elements", "1", {
            packages: "transliteration"
        });

        function onLoad() {
            var options = {
                sourceLanguage: google.elements.transliteration.LanguageCode.ENGLISH,
                destinationLanguage: [google.elements.transliteration.LanguageCode.HINDI],
                shortcutKey: 'ctrl+g',
                transliterationEnabled: true
            };

            var control = new google.elements.transliteration.TransliterationControl(options);
            control.makeTransliteratable(['TextBox3']);
            //TEXT1 is the id of the control which you will use for the transliteration.
        }
        google.setOnLoadCallback(onLoad);
    </script>
</head>
<body>
    <form id="form1" runat="server">

    <div>
        <div class="Google-transliterate-Way2blogging">
        <asp:TextBox ID="TextBox3" TextMode="MultiLine" Width="162px" Height="30px"

                runat="server"></asp:TextBox>
        <br />
        <br />


        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        <br />
        <br />
        <br />
        <br />
        </div>
    </div>
    </form>
</body>
</html>



aspx.cs:


aspx.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

public partial class ex : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("your connecting string");
        con.Open();
        SqlCommand cmd = new SqlCommand("Insert into Test_Lang(strText) values(N'"+TextBox3.Text+"')", con);
        cmd.ExecuteNonQuery();
        con.Close();
    }
    
}


这篇关于ASp.net Web开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆