Click here to Skip to main content
15,901,666 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
Hai.. I am using visual studio 2010. SQL Server 2008. I want to give the tamil input to the text box and i want to store in the database.

My coding:
C#
private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                cn.Open();
                SqlCommand cmd = new SqlCommand("INSERT INTO Sample(Value) VALUES (@NAME)", cn);
                cmd.Parameters.AddWithValue("Name",textBox1.Text);
                cmd.ExecuteNonQuery();
                MessageBox.Show("Success");
                cn.Close();

            }
            catch
            {
                MessageBox.Show("Error");
            }
        }


        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                cn.Open();
                da = new SqlDataAdapter("Select * from Sample", cn);
                ds = new DataSet();
                da.Fill(ds);
                dataGridView1.DataSource = ds.Tables[0];
                cn.Close();
            }

            catch
            {
                MessageBox.Show("Error");
            }
        }


I am using Google Tamil Input.
How to give Tamil input to the text box and how to store it in Database. Please Help me..
Posted
Updated 10-Sep-13 1:21am
v2
Comments
[no name] 10-Sep-13 7:15am    
cmd.Parameters.AddWithValue("@NAME.Text);
Vijaydhas 10-Sep-13 7:28am    
I used this code. Still now i can't insert the value. The value is stored like ?????. If i retrieve this Data to text box mean that also show like ?????.

textBox2.Text=ds.Tables[0].Rows[5][0].ToString();

the value return like ?????.
[no name] 10-Sep-13 7:23am    
what is the datatype for @NAME..??
Vijaydhas 10-Sep-13 7:29am    
Data type is varchar(50)
[no name] 10-Sep-13 7:34am    
Try changing to nvarchar..

To store other languages in SQL server, check this
Storing and Retrieving Non-English Unicode Characters (Hindi, Czech, Arabic etc.) in SQL Server[^]
For Tamil, you have to use Tamil font. Check this
Type Tamil Word in Textbox in C#.net[^]
 
Share this answer
 
storing-tamil-text-to-database[^]

and try changing the datatype to nvarchar()

Check the link..
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900