如何使用Hibernate保存到数据库? [英] How Do I Save To Database Using Hibernate ?
问题描述
你好,
i使用nhibernate for .net程序,
我发现的很奇怪,我不能将文字保存到文本中有'符号的数据库,
如果我有这个标志,我怎么保存它?
例:
*这可以保存到数据库< - 这个字符串可以使用NHibernate成功保存到数据库,
*这个不能保存到数据库< - 这串发生了什么事?所以它不能保存到数据库
感谢您的帮助
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
推荐答案
在这两个陈述中你可以找到区别:
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
不能
在声明2中有单引号。这个单引号就是在那里终止了句子。因此,它无法在数据库中保存两个值(即这可以
并且保存到数据库
)。 br />
试试这个文字:
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
这篇关于如何使用Hibernate保存到数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!