我在jsp里了一个表单得到了一个float的price,现在我要在数据库里更新

来源:百度知道 编辑:UC知道 时间:2024/06/09 02:47:57
我写的语句是 int row1 = statment.executeUpdate("update Title set prices ='"price"' where Isbn = '"+I+"';);

但是就是报错是不是price在里面写的格式没有对啊,麻烦大家帮我看看

sql语句里面的引号不正确:statment.executeUpdate("update Title set prices ='"+price+"' where Isbn = '"+I+"'";);

price为变量,连接用+号
你看看price字段是字符还是数字,若是数字sql改为statment.executeUpdate("update Title set prices ="+price+" where Isbn = '"+I+"';);
若是字符,改为statment.executeUpdate("update Title set prices ='"+price+"' where Isbn = '"+I+"';);