我如何将整数值转换为java中的字符串值

时间:2015-11-10 12:35:36

标签: java sql

String doc = String.valueOf(po.get_Value("DocumentNo"));

我使用了上面的代码,但它仍然在查询中取整数值。 下面我提到了我想要String值的查询。

String sql = "update C_partial SET IsExported = 'Y' where documentno ="+doc;

3 个答案:

答案 0 :(得分:4)

使用PreparedStatement

.center-me

只是safer且更清洁

答案 1 :(得分:0)

您可以使用

String.valueof();
像这样添加'到您的查询

String sql = "update C_partial SET IsExported = 'Y' where documentno = '"+String.valueOf(doc) +"'";

答案 2 :(得分:0)

你需要用撇号字符包装

<!--load_essentials.js-->
document.write('<link rel="stylesheet" type="text/css" href="css/style.css" />');
document.write('<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />');
document.write('<script src="js/jquery.js" type="text/javascript"></script>');

document.getElementById("myHead").innerHTML =
"<span id='headerText'>Title</span>"
+ "<span id='headerSubtext'>Subtitle</span>";
document.getElementById("myNav").innerHTML =
"<ul id='navLinks'>"
+ "<li><a href='index.html'>Home</a></li>"
+ "<li><a href='about.html'>About</a>"
+ "<li><a href='donate.html'>Donate</a></li>"
+ "</ul>";
document.getElementById("myFooter").innerHTML =
"<p id='copyright'>Copyright &copy; " + new Date().getFullYear() + " You. All"
+ " rights reserved.</p>"
+ "<p id='credits'>Layout by You</p>"
+ "<p id='contact'><a href='mailto:you@you.com'>Contact Us</a> / "
+ "<a href='mailto:you@you.com'>Report a problem.</a></p>";

<!--HTML-->
<header id="myHead"></header>
<nav id="myNav"></nav>
Content
<footer id="myFooter"></footer>

<script src="load_essentials.js"></script>