Reader Level:
ARTICLE

Insert HINDI Font in ASP.NET web page to SQL Database

Posted by Prabhakar Parihar Articles | ASP.NET Programming April 08, 2011
In many sites we save HINDI data in a SQL data base. But is too difficult to insert a HINDI font into data base. I tried to solve this problem. Then this works exactly.
  • 0
  • 0
  • 15769


In many sites we save HINDI data in a SQL data base. But is too difficult to insert a HINDI font into data base. I tried to solve this problem. Then this works exactly.

HindiFont1.gif

First create one table tbhindi in sql 2000

First create columns sno , username, fullname.

In the fullname column I store Hindi (UNICODE).

HindiFont2.gif

Then create a new WEBSITE.

In A Website

First you add a Google API for translating English to any language. On this location click on this link:
http://code.google.com/p/google-language-api-for-dotnet/downloads/detail?name=GoogleTranslateAPI_0.1.zip

On this link you download GoogleTranslateAPI_0.1.zip folder. Then create in a website a bin folder and put GoogleTranslateAPI.dll & Newtonsoft.Json.dll
after adding a bin folder with .dll then you create your .aspx page.

In .aspx page

First add controls; a textbox, a Button, a Label and a Girdview.

After naming the control write code for the Button.

On a Button1_Click


protected void Button1_Click(object sender, EventArgs e)
    {
        string Text = TextBox1.Text;
        Console.WriteLine("Before Translation:{0}", Text);
        Text = Google.API.Translate.Translator.Translate(Text, Google.API.Translate.Language.English,
        Google.API.Translate.Language.Hindi);
        Label1.Text = Text;

        string constr1;
        IFormatProvider culture = new CultureInfo("fr-Fr", true);
        constr1 = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        con = new SqlConnection(constr1);
        con.Open();
        string sql = "insert into tbHindi(username,Fullname) values('" + TextBox1.Text + "',N'" + Label1.Text + "')";
        cmd = new SqlCommand(sql, con);
        int res;
        res = cmd.ExecuteNonQuery();
        res = 1;
        con.Close();
        GridView1.DataBind();

    }

Conclusion

I think that's the solution to help for you. 

Article Extensions
Contents added by Guddoo Chauhan on Dec 04, 2012
hi 
  I an try this code but i am find out error Translate failed! please help me :
                                                                                                              thanks

                                                                                 
COMMENT USING

Trending up