Click here to Skip to main content
15,946,525 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to insert BANGLA into sql database. Here is my code.
SQL
INSERT INTO [classTb] ([class]) VALUES (N'" + textbox01.Text+ "')

This insert command work but it store only ??? not BANGLA. What wrong I have done?
Posted
Updated 9-Jun-20 2:54am
Comments
[no name] 11-Dec-13 7:13am    
What is the datatype you are using for that field..??
Harshil_Raval 11-Dec-13 7:13am    
what is datatype of class in classTb?
sazzad37 11-Dec-13 7:34am    
varchar

Well, first off you have left yourself wide open to SQL Injection attacks... Do not concatenate strings to build a SQL command. It leaves you wide open to accidental or deliberate SQL Injection attack which can destroy your entire database. Use Parametrized queries instead.

Secondly, check that the class column is declared as NVARCHAR not VARCHAR.

If it is, look at the code you are using to retrieve the data - it may be that that has the problem.
 
Share this answer
 
Comments
sazzad37 11-Dec-13 7:42am    
Thank's. It's work.
OriginalGriff 11-Dec-13 7:48am    
You're welcome!
Please change data type of column [class] to NVARCHAR from VARCHAR. Hope your problem will be resolved.
 
Share this answer
 
Comments
[no name] 9-Jun-20 9:08am    
And do you think you added something useful/new after about 7 years that is not already included in Solution 1? I suggest to delete this answer to prevent you from "down votes" ;)

[Edit]
What has now started without my intervention!

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