我用JDBC插入记录,执行后数据库中正常,但是页面却显示异常。大家帮忙看看。
String sql = "INSERT INTO table(a,b) values (?,?)";try{
PreparedStatement ps = null;
ps = con.prepareStatement(sql);
ps.setString(1,"x");
ps.setString(2,"y");
} catch (SQLException e)
{ e.printStackTrace();
throw new RuntimeException("error.unexpected");
}
}
String sql = "INSERT INTO table(a,b) values (?,?)";try{
PreparedStatement ps = null;
ps = con.prepareStatement(sql);
ps.setString(1,"x");
ps.setString(2,"y");
} catch (SQLException e)
{ e.printStackTrace();
throw new RuntimeException("error.unexpected");
}
}
有可能是你的 插入功能 已经完成了
可是在你调用 显示功能 时出错
看看你的错误提示怎么说的