if (c!=null){
x=c.size();
a = new String[x][4];
d=new int[x];
f=new int[x];
try { //取得库连接
conn = DBAccess.getConnection();
if (conn == null)
throw new VnetException(VnetException.DATABASE_ERROR, "数据库链接为空。");
for (int i = 0; i < c.size(); i++) {
String code = c.get(i).toString(); System.out.println(code);
// x=c.size();
a = new String[x][4];
a[i][0]=code;
//d=new int[x];
System.out.print(a[i][0]);
String sql1 = "select sum(card_num) from card_batch where card_code='" +
code + "'and status='01'";
PreparedStatement pstmt = conn.prepareStatement(sql1);
ResultSet res1 = pstmt.executeQuery();
if (res1.next())
{a[i][1] =String.valueOf(res1.getInt("sum(card_num)"));
System.out.println("haha------you are boy");
System.out.println(a[i][1]);
d[i]=res1.getInt("sum(card_num)"); }
res1.close();
pstmt.close();
// }
// catch (Exception e) {
// e.printStackTrace();
//return null;}
//finally {
//if (conn!=null)
// DBAccess.rollback(conn); // }
//try { //取得库连接
// conn = DBAccess.getConnection();
if (conn == null)
throw new VnetException(VnetException.DATABASE_ERROR, "数据库链接为空。");
// for (int i = 0; i < c.size(); i++) {
// String code = c.get(i).toString();
//x=c.size();
String sql2 = "select count(*) from card_detail t where card_id like '" +
code + "%' and t.activate_date is not null";
//PreparedStatement pstmt = conn.prepareStatement(sql2);
pstmt = conn.prepareStatement(sql2);
//ResultSet res1 = pstmt.executeQuery();
res1 = pstmt.executeQuery();
//f=new int[x];
if (res1.next())
{a[i][2] = String.valueOf(res1.getInt("count(*)"));
System.out.println("haha------you are gay");
System.out.println(a[i][0]);
System.out.println(a[i][1]);
System.out.println(a[i][2]);
f[i]=res1.getInt("count(*)");}
res1.close();
pstmt.close();}
}
catch(Exception e) {
e.printStackTrace();}
finally { //if (conn!=null)
// DBAccess.rollback(conn);
} // for (int i = 0; i < c.size(); i++)
// {
// a[i][3]=String.valueOf(d[i]-f[i]);}
// for (int i=0;i<c.size();i++)
// {for (int j=0;j<4;j++)
// {System.out.println(a[i][j]);}}
System.out.println(a[1][0]);
return a;
}
else return null;
}
x=c.size();
a = new String[x][4];
d=new int[x];
f=new int[x];
try { //取得库连接
conn = DBAccess.getConnection();
if (conn == null)
throw new VnetException(VnetException.DATABASE_ERROR, "数据库链接为空。");
for (int i = 0; i < c.size(); i++) {
String code = c.get(i).toString(); System.out.println(code);
// x=c.size();
a = new String[x][4];
a[i][0]=code;
//d=new int[x];
System.out.print(a[i][0]);
String sql1 = "select sum(card_num) from card_batch where card_code='" +
code + "'and status='01'";
PreparedStatement pstmt = conn.prepareStatement(sql1);
ResultSet res1 = pstmt.executeQuery();
if (res1.next())
{a[i][1] =String.valueOf(res1.getInt("sum(card_num)"));
System.out.println("haha------you are boy");
System.out.println(a[i][1]);
d[i]=res1.getInt("sum(card_num)"); }
res1.close();
pstmt.close();
// }
// catch (Exception e) {
// e.printStackTrace();
//return null;}
//finally {
//if (conn!=null)
// DBAccess.rollback(conn); // }
//try { //取得库连接
// conn = DBAccess.getConnection();
if (conn == null)
throw new VnetException(VnetException.DATABASE_ERROR, "数据库链接为空。");
// for (int i = 0; i < c.size(); i++) {
// String code = c.get(i).toString();
//x=c.size();
String sql2 = "select count(*) from card_detail t where card_id like '" +
code + "%' and t.activate_date is not null";
//PreparedStatement pstmt = conn.prepareStatement(sql2);
pstmt = conn.prepareStatement(sql2);
//ResultSet res1 = pstmt.executeQuery();
res1 = pstmt.executeQuery();
//f=new int[x];
if (res1.next())
{a[i][2] = String.valueOf(res1.getInt("count(*)"));
System.out.println("haha------you are gay");
System.out.println(a[i][0]);
System.out.println(a[i][1]);
System.out.println(a[i][2]);
f[i]=res1.getInt("count(*)");}
res1.close();
pstmt.close();}
}
catch(Exception e) {
e.printStackTrace();}
finally { //if (conn!=null)
// DBAccess.rollback(conn);
} // for (int i = 0; i < c.size(); i++)
// {
// a[i][3]=String.valueOf(d[i]-f[i]);}
// for (int i=0;i<c.size();i++)
// {for (int j=0;j<4;j++)
// {System.out.println(a[i][j]);}}
System.out.println(a[1][0]);
return a;
}
else return null;
}
解决方案 »
- 求教JavaEE DataSouce中数据库名修改后,启动Tomcat后还一直会去找旧的数据库名
- ssh2 spring里没加 scope="prototype"为什么取不到上次访问过的值
- java反编译jar为Java文件
- ssh 和 MyEclipse 问题
- 求个位大侠帮个忙
- org.apache.catalina.core.StandardContext start 错误
- Applet的MessageBox问题~~~~急急急急急急~~~
- 老长时间上不来了, 终于上来, 高兴散分, 同时提问: 我在tomcat5下如何设立一个myapp这样的虚ni目录, 高分
- 谁能详细说一下WEBLOGCI中的DataSource和TxDataSource的区别????
- Mybaits框架,后台老是报错,不知如何解决,急急急,在线等
- eclipse+lomboz +tomcat 每次修类重新编译后都要发布一次,并且要删除tomcat下的已发布的目录,才可更新!发布一次要几分种!
- 请问深圳好的人才网站有那些
为什么不用arraylist???