What is the problem in the next Java / SQL code sequence?

I updated the table in the access through Java code, but it didn't work However, when I print the result of executeupdate () to the console, it shows me 1, but there is no change in the database Can you tell me what the problem is?

System.out.println("here");
PreparedStatement st = conn.prepareStatement(
    "UPDATE StocProduseCuFactura SET cantitate = " +
    "cantitate - ? WHERE nume = ? and um = 'buc'");
st.setInt(1,cant);
st.setString(2,p.getNume());
System.out.println(st.executeUpdate());
st.close();

I forgot to say that if I run the SQL code in the access, it will work

Solution

Do you ensure that the transaction has been submitted?

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>