Hello everyone!! Today I am struggling with SQL queries but I am not able to get the expected result. I'd like to make some maths on my database. Precisely: I want to multiplicate the value of Importo (Importo=Importo value) by Codice, update the database and show the new table. import java.sql.*; import java.io.*; public class Prova { private float importo; private int codice; public Prova() {} InputStreamReader input = new InputStreamReader(System.in); BufferedReader tastiera = new BufferedReader(input);...
I have just found the mistake: I have to add stm.setInt(3, codice) before stm.executeUpdate. Thanks a lot anyway
Thanks Gord Thompson. I' ve just written in the proper way and now it works. I didn't notice the spaces (the comma was an oversight. Now I have another problem with another class. I wrote a class to update a record by a code but I get the following error: UCAExc:::4.0.4 Parameter not set import java.io.*; import java.sql.*; public class Aggiornamento { public Aggiornamento() {} private int codice; private String descrizione; private float importo; InputStreamReader input = new InputStreamReader(System.in);...
Thanks Gord Thompson. I' ve just written in the proper way and now it works. I didn't notice the spaces (the comma was an oversight. Now I have another problem with other two classes. I wrote two classes: one to delete a record by a code and another class to update a record by a code. The result is that all the record in the dabase file are deleted in the first case and all updated in the second case. Bu t I want to delete a single record by code or update a single record by code too import java.io.;...
Hello to evryone. I am just trying to use UcanAccess driver to practice some Java code for database. I have the following class but I get: UCAExc:::4.0.4 unexpected token: DESCRIZIONE import java.io.*; import java.sql.*; public class Visualizzazione { private String descrizione; public Visualizzazione() {} public void visualizza() { InputStreamReader input = new InputStreamReader(System.in); BufferedReader tastiera = new BufferedReader(input); try { Connection con =DriverManager.getConnection("jdbc:ucanaccess://C:/DB/Database2.accdb");...