//添加帐务信息
public boolean saveAllAccount(MyAccount account)throws Exception
{
conn=DBCon.getConnection();
String listSQLtj="insert into myaccount value(?,?,?,?)";
PreparedStatement psmt=conn.prepareStatement(listSQLtj);
try
{
psmt.setDouble(1, account.getIncomemoney());
psmt.setDouble(2, account.getCostmoney());
psmt.setString(3, account.getRecord());
psmt.setString(4, account.getTime());
psmt.executeUpdate();
conn.commit();
return true;
}你这里把你的sql加入到psmt.executeUpdate(sql);试试
public boolean saveAllAccount(MyAccount account)throws Exception
{
conn=DBCon.getConnection();
String listSQLtj="insert into myaccount value(?,?,?,?)";
PreparedStatement psmt=conn.prepareStatement(listSQLtj);
try
{
psmt.setDouble(1, account.getIncomemoney());
psmt.setDouble(2, account.getCostmoney());
psmt.setString(3, account.getRecord());
psmt.setString(4, account.getTime());
psmt.executeUpdate();
conn.commit();
return true;
}你这里把你的sql加入到psmt.executeUpdate(sql);试试
解决方案 »
- DataSource里找不到getConnection方法
- MySQL死了?
- FireFox 中Struts 出现的问题,IE中没有出现.高手赐教!!
- struts2 session获取不到,在线求大神解决
- 一个弱智的问题!!
- 怎样使Weblogic启动以后自动实例化其中一个EJB,即调用ejbCreate()方法!
- thinking in java中的一个列子有问题请过来帮忙看看
- 查找EJB时Context.lookup("")出错,返回null
- hibernate 一对一关系描述象这样怎么写?
- 高手请进!!把jtable的数据保存为excel格式!怎么做?
- 单行子查询返回多个行
- 文本框怎么自动联想?
你这代码正常的话,调sava方法的时候应该抛异常才是