0
点赞
收藏
分享

微信扫一扫

jsp新代码第230课

自由的美人鱼 2022-05-14 阅读 167


new230.java

package pack03;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

public class new230
{

public int executeUpdata(String sql,List<Object> list)
{
Connection conn = null;
PreparedStatement pstmt = null;

conn = new229.getConnection();
try
{
pstmt = conn.prepareStatement(sql);
if(list == null)
{
return pstmt.executeUpdate();
}

int i = 1;
for (Object obj : list)
{
pstmt.setObject(i, obj);
i++;
}

return pstmt.executeUpdate();
}
catch (SQLException e)
{
e.printStackTrace();
}
finally
{
new229.close(pstmt);
new229.close(conn);
}

return 0;
}
}


举报

相关推荐

0 条评论