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;
}
}