access中我不懂得是如何在sql语句中用变量来更改数据的值,而我数据库中得balance值是float型的,我不知道原因出在哪里 能否帮我解答一下 赶紧不尽啊
System.out.println("enter the money to save");
int id =0;
float moneys = reader.nextFloat();
acc.Deposit(moneys);
float getMoney = 111;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
System.out.println(e);
}
System.out.println("1");
try{
con = DriverManager.getConnection("jdbc:odbc:mydata","","");
sql = con.createStatement();
rs = sql.executeQuery("update db set balance="+getMoney+" where id="+id+"");
con.close();
}
catch(SQLException e){
System.out.println(e);
}