mardi 21 avril 2015

Unable to update value in database using AND operator in postgresql

I'm working on a Java swing application in which I'm trying to update postgresql database when user make any changes. There are four fields in the tables, If i try to update one column at a time it's working fine but when I use AND then It display following error message to me

Caught Exception:- org.postgresql.util.PSQLException: ERROR: argument of AND must be type boolean, not type character varying

Given below is code that I'm using to update table.

Connection con = DbConnection.getConnect();
Statement stmt = con.createStatement();
String sql = "UPDATE webservice_config set product = ? AND product_cat = ? AND stock = ? where ID=?;";
PreparedStatement pstInsert = con.prepareStatement(sql);
pstInsert.setString(1, product);
pstInsert.setString(2, productCat);
pstInsert.setString(3, stock);
pstInsert.setString(4, "1");

Any Help

Aucun commentaire:

Enregistrer un commentaire