Reputation: 315
String doc = String.valueOf(po.get_Value("DocumentNo"));
I used above code but still it's taking the integer value in the query.
Below I mentioned the query where I want the String
value.
String sql = "update C_partial SET IsExported = 'Y' where documentno ="+doc;
Upvotes: 1
Views: 377
Reputation: 23329
String sql = "update C_partial SET IsExported = 'Y' where documentno =?";
PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setString(1, doc);
It is just safer and cleaner
Upvotes: 4
Reputation: 2471
You can use
String.valueof();
like this and add ' to your query
String sql = "update C_partial SET IsExported = 'Y' where documentno = '"+String.valueOf(doc) +"'";
Upvotes: 0
Reputation: 317
You need to wrap with apostrophe characters
String sql = "update C_partial SET IsExported = 'Y' where documentno = '"+doc+"'";
Upvotes: 0