gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 03:03:08 25 4
gpt4 key购买 nike

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

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

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

最佳答案

使用PreparedStatement

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

PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setString(1, doc);

就是safer和清洁工

关于java - 我如何在java中将整数值转换为字符串值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33630129/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com