错误是:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]将截断字符串或二进制数据。 我查到说是: 数据库字段长度设置小了,但是我不知道该怎么找是哪个数据库的哪个字段,下面是我的源程序,高手指点
<%@ page contentType="text/html; charset=GBK" %>
<%@include file="../commonPage/check.jsp"%>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<html>
<head> <title>
科室/文书量统计结果
</title>
<link rel="stylesheet" href="../commonPage/css/style.css" type="text/css">
<jsp:useBean id="conn" scope="page" class="cn.gov.whwsjd.ConnectBean"/>
</head>
<body bgcolor="#ffffff">
<%
//当前时间
DateFormat format1=new SimpleDateFormat("yyyy-MM-dd");
DateFormat format2=new SimpleDateFormat("yyyy");
String nowDate=format1.format(new Date());
String nowYear=format2.format(new Date()); String from=new String(request.getParameter("from").getBytes("iso-8859-1"), "GBK");
String to=new String(request.getParameter("to").getBytes("iso-8859-1"), "GBK");
String myTable=new String(request.getParameter("myTable").getBytes("iso-8859-1"), "GBK");
String subType=new String(request.getParameter("subType").getBytes("iso-8859-1"), "GBK");
//out.println(subType);
//默认时间本年度
if(from.equals("")){
from=nowYear+"-01-01";
}
if(to.equals("")){
to=nowDate;
} try{
Vector v=new Vector();
Map map=new HashMap();
conn.connetDatabase();
//得到所有室
conn.rs=conn.statement.executeQuery("select dept_name from deptment_table where dept_name like '%室' order by dept_name asc");
while(conn.rs.next()){
map.put(conn.rs.getString("dept_name"),new HashMap());
v.add(conn.rs.getString("dept_name"));
}
conn.proc=conn.coonection.prepareCall("{call keshi_wenshu_statistic(?,?,?,?)}");
conn.proc.setString(1,from);
conn.proc.setString(2,to);
conn.proc.setString(3,myTable);
conn.proc.setString(4,subType);
conn.proc.execute();
conn.rs=conn.proc.getResultSet();
Map temp=new HashMap();
while(conn.rs.next()){
if(map.containsKey(conn.rs.getString("dept"))){
temp=(Map)map.get(conn.rs.getString("dept"));
temp.put(conn.rs.getString("wenshu"),conn.rs.getString("num"));
map.remove(conn.rs.getString("dept"));
map.put(conn.rs.getString("dept"),temp);
}
}
conn.closeCoonet();
//合计
int[] totle=new int[5];
%>
<table width="80%" align="center" cellpadding="3" cellspacing="0" class="table02">
<tr valign="middle">
<td width="100%">
<!--标题begin-->
<table width="100%" cellpadding="0" cellspacing="0" class="table02">
<tr>
<td class="td01" align="center"> <font style="font-family:隶书;font-size:16pt"> <b>科室/文书量统计 </b> </font> </td>
</tr>
<tr>
<td class="td01" width="100%" align="right">
统计时间段: <%=from %>至 <%=to %> <%=session.getAttribute("userName") %> <%=nowDate %>
</td>
</tr>
</table>
<!--标题end-->
</td>
</tr>
<tr>
<td>
<!--结果begin-->
<table width="100%" cellpadding="0" cellspacing="0" class="table01">
<tr class="tr01">
<td class="td03" align="center" width="14%">科室 </td>
<td class="td03" align="center" width="14%">监测报告 </td>
<td class="td03" align="center" width="14%">笔录 </td>
<td class="td03" align="center" width="14%">意见书 </td>
<td class="td03" align="center" width="14%">产品检验报告 </td>
<td class="td03" align="center" width="14%">验收报告 </td>
<td class="td03" align="center" width="14%">合计 </td>
</tr>
<%
for(int n=0;n <v.size();n++){
//科室
String deptment=v.get(n).toString();
//行合计
int[] once=new int[6];
if(((Map)map.get(deptment)).containsKey("Pub_inspect_table")){once[0]=Integer.parseInt(((Map)map.get(deptment)).get("Pub_inspect_table").toString());}else{once[0]=0;}
if(((Map)map.get(deptment)).containsKey("Pub_report_table")){once[1]=Integer.parseInt(((Map)map.get(deptment)).get("Pub_report_table").toString());}else{once[1]=0;}
if(((Map)map.get(deptment)).containsKey("Pub_idea_table")){once[2]=Integer.parseInt(((Map)map.get(deptment)).get("Pub_idea_table").toString());}else{once[2]=0;}
if(((Map)map.get(deptment)).containsKey("Pub_product_table")){once[3]=Integer.parseInt(((Map)map.get(deptment)).get("Pub_product_table").toString());}else{once[3]=0;}
if(((Map)map.get(deptment)).containsKey("Pub_result_table")){once[4]=Integer.parseInt(((Map)map.get(deptment)).get("Pub_result_table").toString());}else{once[4]=0;}
once[5]=once[0]+once[1]+once[2]+once[3]+once[4];
totle[0]+=once[0];
totle[1]+=once[1];
totle[2]+=once[2];
totle[3]+=once[3];
totle[4]+=once[4];
%>
<tr>
<td class="td03" align="center" width="12%"> <%=deptment%> </td>
<td class="td03" align="center" width="12%"> <%=once[0]%> </td>
<td class="td03" align="center" width="12%"> <%=once[1]%> </td>
<td class="td03" align="center" width="12%"> <%=once[2]%> </td>
<td class="td03" align="center" width="12%"> <%=once[3]%> </td>
<td class="td03" align="center" width="12%"> <%=once[4]%> </td>
<td class="td03" align="center" width="12%"> <%=once[5]%> </td>
</tr>
<%} %>
<!--合计-->
<tr>
<td class="td03" align="center" width="12%">合计 </td>
<td class="td03" align="center" width="12%"> <%=totle[0]%> </td>
<td class="td03" align="center" width="12%"> <%=totle[1]%> </td>
<td class="td03" align="center" width="12%"> <%=totle[2]%> </td>
<td class="td03" align="center" width="12%"> <%=totle[3] %> </td>
<td class="td03" align="center" width="12%"> <%=totle[4]%> </td>
<td class="td03" align="center" width="12%"> <%=totle[0]+totle[1]+totle[2]+totle[3]+totle[4]%> </td>
</tr>
</table>
<!--结果end-->
</td>
</tr>
</table>
<%
}catch(Exception e){
System.out.println(e);
System.out.println("科室/文书量统计出错");
}finally{
if(conn.coonection!=null){
conn.closeCoonet();
}
}
%>
</body>
</html>
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]将截断字符串或二进制数据。 我查到说是: 数据库字段长度设置小了,但是我不知道该怎么找是哪个数据库的哪个字段,下面是我的源程序,高手指点
<%@ page contentType="text/html; charset=GBK" %>
<%@include file="../commonPage/check.jsp"%>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<html>
<head> <title>
科室/文书量统计结果
</title>
<link rel="stylesheet" href="../commonPage/css/style.css" type="text/css">
<jsp:useBean id="conn" scope="page" class="cn.gov.whwsjd.ConnectBean"/>
</head>
<body bgcolor="#ffffff">
<%
//当前时间
DateFormat format1=new SimpleDateFormat("yyyy-MM-dd");
DateFormat format2=new SimpleDateFormat("yyyy");
String nowDate=format1.format(new Date());
String nowYear=format2.format(new Date()); String from=new String(request.getParameter("from").getBytes("iso-8859-1"), "GBK");
String to=new String(request.getParameter("to").getBytes("iso-8859-1"), "GBK");
String myTable=new String(request.getParameter("myTable").getBytes("iso-8859-1"), "GBK");
String subType=new String(request.getParameter("subType").getBytes("iso-8859-1"), "GBK");
//out.println(subType);
//默认时间本年度
if(from.equals("")){
from=nowYear+"-01-01";
}
if(to.equals("")){
to=nowDate;
} try{
Vector v=new Vector();
Map map=new HashMap();
conn.connetDatabase();
//得到所有室
conn.rs=conn.statement.executeQuery("select dept_name from deptment_table where dept_name like '%室' order by dept_name asc");
while(conn.rs.next()){
map.put(conn.rs.getString("dept_name"),new HashMap());
v.add(conn.rs.getString("dept_name"));
}
conn.proc=conn.coonection.prepareCall("{call keshi_wenshu_statistic(?,?,?,?)}");
conn.proc.setString(1,from);
conn.proc.setString(2,to);
conn.proc.setString(3,myTable);
conn.proc.setString(4,subType);
conn.proc.execute();
conn.rs=conn.proc.getResultSet();
Map temp=new HashMap();
while(conn.rs.next()){
if(map.containsKey(conn.rs.getString("dept"))){
temp=(Map)map.get(conn.rs.getString("dept"));
temp.put(conn.rs.getString("wenshu"),conn.rs.getString("num"));
map.remove(conn.rs.getString("dept"));
map.put(conn.rs.getString("dept"),temp);
}
}
conn.closeCoonet();
//合计
int[] totle=new int[5];
%>
<table width="80%" align="center" cellpadding="3" cellspacing="0" class="table02">
<tr valign="middle">
<td width="100%">
<!--标题begin-->
<table width="100%" cellpadding="0" cellspacing="0" class="table02">
<tr>
<td class="td01" align="center"> <font style="font-family:隶书;font-size:16pt"> <b>科室/文书量统计 </b> </font> </td>
</tr>
<tr>
<td class="td01" width="100%" align="right">
统计时间段: <%=from %>至 <%=to %> <%=session.getAttribute("userName") %> <%=nowDate %>
</td>
</tr>
</table>
<!--标题end-->
</td>
</tr>
<tr>
<td>
<!--结果begin-->
<table width="100%" cellpadding="0" cellspacing="0" class="table01">
<tr class="tr01">
<td class="td03" align="center" width="14%">科室 </td>
<td class="td03" align="center" width="14%">监测报告 </td>
<td class="td03" align="center" width="14%">笔录 </td>
<td class="td03" align="center" width="14%">意见书 </td>
<td class="td03" align="center" width="14%">产品检验报告 </td>
<td class="td03" align="center" width="14%">验收报告 </td>
<td class="td03" align="center" width="14%">合计 </td>
</tr>
<%
for(int n=0;n <v.size();n++){
//科室
String deptment=v.get(n).toString();
//行合计
int[] once=new int[6];
if(((Map)map.get(deptment)).containsKey("Pub_inspect_table")){once[0]=Integer.parseInt(((Map)map.get(deptment)).get("Pub_inspect_table").toString());}else{once[0]=0;}
if(((Map)map.get(deptment)).containsKey("Pub_report_table")){once[1]=Integer.parseInt(((Map)map.get(deptment)).get("Pub_report_table").toString());}else{once[1]=0;}
if(((Map)map.get(deptment)).containsKey("Pub_idea_table")){once[2]=Integer.parseInt(((Map)map.get(deptment)).get("Pub_idea_table").toString());}else{once[2]=0;}
if(((Map)map.get(deptment)).containsKey("Pub_product_table")){once[3]=Integer.parseInt(((Map)map.get(deptment)).get("Pub_product_table").toString());}else{once[3]=0;}
if(((Map)map.get(deptment)).containsKey("Pub_result_table")){once[4]=Integer.parseInt(((Map)map.get(deptment)).get("Pub_result_table").toString());}else{once[4]=0;}
once[5]=once[0]+once[1]+once[2]+once[3]+once[4];
totle[0]+=once[0];
totle[1]+=once[1];
totle[2]+=once[2];
totle[3]+=once[3];
totle[4]+=once[4];
%>
<tr>
<td class="td03" align="center" width="12%"> <%=deptment%> </td>
<td class="td03" align="center" width="12%"> <%=once[0]%> </td>
<td class="td03" align="center" width="12%"> <%=once[1]%> </td>
<td class="td03" align="center" width="12%"> <%=once[2]%> </td>
<td class="td03" align="center" width="12%"> <%=once[3]%> </td>
<td class="td03" align="center" width="12%"> <%=once[4]%> </td>
<td class="td03" align="center" width="12%"> <%=once[5]%> </td>
</tr>
<%} %>
<!--合计-->
<tr>
<td class="td03" align="center" width="12%">合计 </td>
<td class="td03" align="center" width="12%"> <%=totle[0]%> </td>
<td class="td03" align="center" width="12%"> <%=totle[1]%> </td>
<td class="td03" align="center" width="12%"> <%=totle[2]%> </td>
<td class="td03" align="center" width="12%"> <%=totle[3] %> </td>
<td class="td03" align="center" width="12%"> <%=totle[4]%> </td>
<td class="td03" align="center" width="12%"> <%=totle[0]+totle[1]+totle[2]+totle[3]+totle[4]%> </td>
</tr>
</table>
<!--结果end-->
</td>
</tr>
</table>
<%
}catch(Exception e){
System.out.println(e);
System.out.println("科室/文书量统计出错");
}finally{
if(conn.coonection!=null){
conn.closeCoonet();
}
}
%>
</body>
</html>
解决方案 »
- Freemarker导出Word文档问题
- 急!关于JNative的问题,在线求等大虾解决!!!!
- hibernate 小问题
- 初学问题Exception sending context initialized event to listener instance of class
- IPhone问题,新手刚接触Iphone请高手指点!
- spring与struts问题
- 可以对HashMap里的记录按某个字段值排序吗?
- 初学JSP,配好了JDK1.5 tomcat5.5后.......
- 怎么把这样的一个XML读到Vector中
- 求教 JDeveloper + Struts + BC4J 中的<jbo:xxxx> 这类标签的用法
- 这个错,谁能解决,牛逼+高分奖励
- 关于远程调用webservice(救救我啊,要交货了!)
你把数据库地字段都改大一点撒
只有根据报错行数慢点找啊
没有别的办法啊