.DB代码中的Oracle DB sql语句 [英] Oracle DB sql statement in .Net code
本文介绍了.DB代码中的Oracle DB sql语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Oracle SQL Developer错误 [ ^ ],我在Oracle SQL Developer中发布了SQL语句,其中应该用于字段名称(ImagePath here),像那样
SELECT * FROM tbl_datacategory其中ImagePath ='Images \ $ C $ b与MS Access中的不同,如下所示:
SELECT * FROM tbl_datacategory其中ImagePath ='Images \DataCategory \Icons\Bus \'
在我的ASP.Net中,我该如何添加访问Oracle DB的语句中的双?我的MS Access数据表的原始代码如下所示
string sqlClause = SELECT * FROM + tblName + 其中 +
fieldName + =' + strCategory + ', tblCatalog
谢谢。
解决方案
参考 http://social.msdn.microsoft.com/Forums/en-US/0ddeb6e0-ac97-4e44-8a79-73efce673bdf/how-to-include-双引号加在 - 分号 - 到 - 一个字符串-VA riable?forum = csharpgeneral [ ^ ],喜欢那样
退出他们 放置' \' 前 他们:
他说\ Wow \
问题解决了。感谢您的评论。
In Oracle SQL Developer Error[^], I posted the SQL statement in Oracle SQL Developer, where " " should be used for the field name (ImagePath here), like that
SELECT * FROM tbl_datacategory where "ImagePath" = 'Images\DataCategory\Icons\Bus\'
which is different from that in MS Access, like that below:
SELECT * FROM tbl_datacategory where ImagePath = 'Images\DataCategory\Icons\Bus\'
In my ASP.Net, how can I added the double "" in the statement for accessing Oracle DB? My original code for MS Access data table likes that below"
string sqlClause = "SELECT * FROM " + tblName + " where " +
fieldName + " = '" + strCategory + "'", "tblCatalog"
Thanks.
解决方案 Referring http://social.msdn.microsoft.com/Forums/en-US/0ddeb6e0-ac97-4e44-8a79-73efce673bdf/how-to-include-double-quotes-plus-the-semi-colon-into-a-string-variable?forum=csharpgeneral[^], doing likes that
Escape them by placing a '\' in front of them:
"He said \"Wow\""
Problem got solved. Thanks for your review.
这篇关于.DB代码中的Oracle DB sql语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文