Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Kotti
Posting Yak Master
129 Posts |
Posted - 2010-02-26 : 02:33:04
|
| Hello Friends,I want to insert chinese characters into the database ,so i used the word N in front of the values and successfully inserted.Find the below query for your reference.Insert into Users(Name)Values(N'"+ strName + "') But when i used the insert query with the parameters ,where i need to place the N.Find the below query for your referencestring iqry = "Insert into Users(Test)Values(@Name)"; cmd = new SqlCommand(iqry, con); cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = strName ;Could you please suggest me in this regards.Please let me know if you need anything further.If you have any other method to insert the Chinese characters into the database also please suggest me.Thank you in Advance. |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-02-26 : 02:50:56
|
| You can use stored procedure in place of sql query and in stored procedure and there you use dynamic query to concatenate N with the SQL Statement and then execute itVabhav T |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-02-26 : 02:55:58
|
quote: Originally posted by Kotti Hello Friends,I want to insert chinese characters into the database ,so i used the word N in front of the values and successfully inserted.Find the below query for your reference.Insert into Users(Name)Values(N'"+ strName + "') But when i used the insert query with the parameters ,where i need to place the N.Find the below query for your referencestring iqry = "Insert into Users(Test)Values(@Name)"; cmd = new SqlCommand(iqry, con); cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = strName ;Could you please suggest me in this regards.Please let me know if you need anything further.If you have any other method to insert the Chinese characters into the database also please suggest me.Thank you in Advance.
Declare the parameter as nVarcharPBUH |
 |
|
|
Kotti
Posting Yak Master
129 Posts |
Posted - 2010-02-26 : 04:15:32
|
| Hello Idera,Thank you for addressing this problem.Now it was accepting the Chinese characters after changing to NVarchar.Thanks Kotti |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-02-26 : 04:54:52
|
quote: Originally posted by Kotti Hello Idera,Thank you for addressing this problem.Now it was accepting the Chinese characters after changing to NVarchar.Thanks Kotti
You are welcomePBUH |
 |
|
|
|
|
|
|
|