Click here to Skip to main content
16,012,116 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
my problem is how to pass the Hindi letters from c# .net pages to my stored procedures?

I've written a sql stored procedure like this

SQL
CREATE proc [testinsert]
(
@nameE nvarchar(max),
@nameT nvarchar(Max)
)
as
begin
   INSERT INTO tblmultilangstudentE ([name]) VALUES (@nameE);
   INSERT INTO tblmultilangstudentT ([name]) VALUES (@nameT);
end



i passed the values like this

C#
SqlCommand cmd = new SqlCommand("testinsert", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@nameE", txtEng.Text);
cmd.Parameters.AddWithValue("@nameT", txtTamil.Text);
con.Open();
cmd.ExecuteNonQuery();
con.Close();



But it's not store the Hindi values in tblmultilangstudentT Table.In database
only '?????' submited. A critical Problem for advance brainers. Thanks in Advance........

[edit]Code blocks added for clarity - OriginalGriff[/edit]
Posted
Updated 14-Nov-10 17:39pm
v3
Comments
Member 14141429 6-Feb-19 2:41am    
I also face this problem of ???? on saving the data in hindi

Specify the data type while adding parameters.

SQL
cmd.Parameters.Add("@CategoryName", SqlDbType.NVarChar)
 
Share this answer
 
Hi,
if you want to insert tamil characters, you must set SqlDataTape of parameters of SqlCommand object.

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.parameters.aspx[^]

cmd.Parameters.Add("@CategoryName", SqlDbType.NVarChar)
 
Share this answer
 
I tried same thing but it like cmd.Parameters.Add("@HindiText", SqlDbType.NVarChar) but it is still not saving Hindi Text into database. But if I execute Insert Query like
Query = "Insert into myTable (HindiTitle) values(N'" + txtTitle.Text + "')";

it is working fine.
 
Share this answer
 

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