Velocity 的应用示例
}
catch (Exception e)
{
//Utilities.debugPrintln(e.getMessage());
e.printStackTrace();
}
return null;
}
public static void excuteDbUpdate(String sql, Object[] parameters)
{
Connection con = Utilities.getDatabaseConnection();
excuteDbUpdate(con, sql, parameters);
closeDbConnection(con);
}
public static void excuteDbUpdate(Connection con, String sql,Object[] parameters)
{
Exception err = null;
try
{
java.sql.PreparedStatement ps = con.prepareStatement(sql);
for (int i = 0;
i <
parameters.length;
i )
{
processParameter(ps, i 1, parameters[i]);
}
ps.execute();
}
catch (Exception e)
{
err = e;
//Utilities.debugPrintln(err.getMessage());
e.printStackTrace();
}
}
private static void processParameter(java.sql.PreparedStatement ps, int index, Object parameter)
{
try
{
if (parameter instanceof String)
文章评论
共有位Admini5网友发表了评论 查看完整内容