Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

i have using nhibernate for .net program,
and what i found is very strange, that i can't save my word to database where there's an " ' " sign in the text,
how do i save it while i have that sign ?

example :
* this can be save to database <-- this string can be successfully save to Database using NHibernate,
* this can't be save to database <-- what happened to this string? so it can't be save to database

thanks for the help
Posted
Comments
ZurdoDev 4-Aug-14 12:44pm    
You would have to show the code you're using. My guess is you are sending the text as a string and if it is like MS SQL, ' is the string terminator so it will fail unless it is escaped.

Click improve question and show the relevant code.

1 solution

In both statements you can find a difference:
String 1: his can be save to database
String 2: this can't be save to database

can't in statement 2 is having a single quote. And this single quote is terminating the sentence there itself. So, it is unable to save two values(i.e. this can and t be save to database) in database.

Try this text:
this can''t be save to database



--Amy
 
Share this answer
 
Comments
Andrew Budiman 8-Aug-14 11:29am    
this also can be done,
still getting an error.

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