Home > Articles > ASP.NET >

 Insert HINDI Font from ASP.NET web page to SQL Server database

Posted by under ASP.NET category on for Intermediate level | Points: 250 | Views : 39483 red flag
Rating: 5 out of 5  
 2 vote(s)
We are In many sites to save HINDI data in SQL data base. But is too difficult to insert HINDI font in data base. I am tried to solve this problem. Then he work exactly .


Firstly create one table tbhindi in sql 2000

Firstly create columns sno , username, fullname

In fullname column I store Hindi (UNICODE)

Fullname column DATA TYPE (nvarchar), after then create new WEBSITE.

In A Website

Firstly u add Google API for translate English to any language . on this location click on this link


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

In .aspx page

Firstly Add control one textbox , Button , Label , Girdview, After Naming  on control write code on 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,


        Label1.Text = Text;


        string constr1;

        IFormatProvider culture = new CultureInfo("fr-Fr", true);

        constr1 = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;

        con = new SqlConnection(constr1);


// IN Realtime application, use parameterized statement to insert data into database

        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;







I think this solution shall help some of you. Thanks



Page copy protected against web site content infringement by Copyscape
About the Author
Full Name: prabhakar parihar
Member Level:
Member Status: Member,MVP
Member Since: 1/12/2011 5:05:40 AM
Country: India
Best Regard's Prabhakar
Currently working as a Software Engineer (Developer) [ ASP.NET , C# ]

Login to vote for this post.

Comments or Responses

Posted by: Sutotpal on: 2/5/2011 | Points: 25
I m giving u full vote...nice...
Posted by: Prabhakar on: 2/5/2011 | Points: 25
Hi Sutotpal,

thanks bro . . fro responding in my article ... hope fully it's a very use full for u ..
Posted by: Bhanubysani on: 6/15/2011 | Points: 25
its not working for some words like pratyusha,pranathi like...wat is the problem
Posted by: Psatyaa on: 7/29/2011 | Points: 25
Hi Prabhakar,

I am working on a project wich requires searching hindi text in pdf. The pdf is in hindi and the searchable text is in notepad file. we have to read the text file and search the text in pdf. I am using Chanakya Font. But while coding in C# the searchable text is shown in some garbage value. I am using string variable. Kindly Guide me.

Posted by: Crajesh on: 9/24/2011 | Points: 25

I used this code but getting Translate fail error.
can u help me?
thanks .
Posted by: Mishraravi on: 1/20/2012 | Points: 25
Hi prabhakar my requirement is same what u have posted here"Insert Hindi font using asp.net in Sqlserver" when i am using ur code after donloading google translator api getting following Error...could you pls reply why it occuring:

Mishra Ravi

Copy exception detail to the clipboardGoogle.API.Translate.TranslateException was unhandled by user code
Message="Translate failed!"
at Google.API.Translate.Translator.Translate(String text, Language from, Language to, TranslateFormat format)
at Google.API.Translate.Translator.Translate(String text, Language from, Language to)
at _Default.btn1_Click(Object sender, EventArgs e) in c:\Multilanguage\Default.aspx.cs:line 25
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: Google.API.Translate.TranslateException
at Google.API.Translate.Translator.Translate(String text, String from, String to, TranslateFormat format)
at Google.API.Translate.Translator.Translate(String text, Language from, Language to, TranslateFormat format)
InnerException: Google.API.GoogleAPIException
Message="[error code:403]Suspected Terms of Service Abuse. Please see http://code.google.com/apis/errors"
at Google.API.RequestUtility.GetResponseData[T](WebRequest request)
at Google.API.Translate.Translator.Translate(String text, String from, String to, TranslateFormat format)

Posted by: Mujisbbj on: 3/28/2012 | Points: 25
I got the following errors on execution

"System.Net.WebException: The remote name could not be resolved: 'ajax.googleapis.com'

I presume that it is beacuase of non connectiviey of internet on my local machine else the coding is OK

pls suggest whether this example requires to connect to google online for translation
Thanks in advance
Posted by: R.Sharma on: 4/28/2012 | Points: 25
i unable to access this code i am using google api but its not working ....... i got error on the line

Google.API.Translate.Translator.Translate(Text, Google.API.Translate.Language.English,

plz give me correct ans pls its urgent what is the header file i can add ????? for access this code

i want to covert an English text to hindi text ..using text box
Posted by: Sakshi.1947 on: 10/15/2012 | Points: 25
its not working.
translation failed error occurred..
Posted by: Anshu.Jaipur on: 10/28/2012 | Points: 25
its not working.
translation failed error occurred..
any other option to do this.

Login to post response

Comment using Facebook(Author doesn't get notification)