非产感谢!
但我还是不明白,下面是程序内容,请各位帮忙看看(两次回复)
<html>
<head>
<title>资产信息</title>
<%@ page language = "java" contentType = "text/html;charset = gb2312" session = "true" %>
<%@ page import="java.sql.*" %>
<%@ page import = "java.io.*,java.util.*" %>
<%@ include file = "../database.jsp" %><script language="JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
<STYLE type=text/css>BODY {
FONT-FAMILY: 宋体, sans-serif; FONT-SIZE: 10pt
}
TD {
FONT-FAMILY: 宋体, sans-serif; FONT-SIZE: 10pt; ALIGN: center
}
</STYLE>
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<%
  String zsBh = "";
  String startDate = "",endDate = "";
  String zs = request.getParameter("zs");
  String startYear = request.getParameter("startYear");
  String endYear = request.getParameter("endYear");
  String startMonth = request.getParameter("startMonth");
  String endMonth = request.getParameter("endMonth");
  if((zs == null)||(zs.length()<1)){
   zsBh="01";
Vector zsmc = new Vector();
zsmc = (Vector)session.getValue("zsmc");
if(zsmc.size() > 0)
zs = (String)zsmc.elementAt(0);
else
zs = "未知";
  }else{
    Hashtable hZs = new Hashtable();
hZs = (Hashtable)session.getValue("hZs");
zsBh = (String)hZs.get(zs);
if((zsBh == null)||(zsBh == "")){
   zsBh = "01";
   }
  }
   String zswhere = "";
    if(zs == null)
          zs="";
  else 
  {
   zs = zs.trim();
//out.write(zs);
 zswhere = " and b.bianhao_gds_out like '" + zs+ "%'";
}
  if(startYear == null)
   startYear = "";
  else
   startYear = startYear.trim();
  if(endYear == null)
   endYear = "";
  else
   endYear = endYear.trim();
java.util.Date d = new java.util.Date();
if(startMonth == null){
//int iiMonth = d.getMonth();
int iiMonth = 1;
if(iiMonth < 10)
startMonth = "0" + iiMonth;
else
startMonth = "" + iiMonth;
}
if(endMonth == null){
int iiMonth = d.getMonth();
if(iiMonth < 10)
endMonth = "0" + iiMonth;
else
endMonth = "" + iiMonth;
}
if((startYear.length()<1)||(endYear.length()<1)){
int iiYear = d.getYear() + 1900;
startDate = iiYear +  "-" + startMonth + "-01 00:00:00.0";
endDate = iiYear +  "-" + endMonth + "-01 00:00:00.0";
}else{
startDate = startYear +  "-" +  startMonth + "-01 00:00:00.0";
endDate = endYear +  "-" + endMonth + "-01 00:00:00.0";
}
%> 
<div align="center"><font size="5" face="宋体"><b><font size="4">电能表资产信息</font></b></font></div>
<br>
<table align = "center" width="1800" border="1" bordercolorlight="#000000" cellspacing="0" bordercolordark="#99CCFF" cellpadding="0" bgcolor="#99CCFF">
  <tr > 
    <td height="35" width="80"> 
      <div align="center"><font size="2">资产编号</font></div>
    </td>
    <td height="35" width="110"> 
      <div align="center"><font size="2">类别 </font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">型号</font></div>
    </td>
    <td height="35" width="50"> 
      <div align="center"><font size="2">倍率</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">电压</font></div>
    </td>
    <td height="35" width="50"> 
      <div align="center"><font size="2">电流</font></div>
    </td>
    <td height="35" width="80"> 
      <p align="center"><font size="2">相别</font></p>
    </td>
    <td height="35" width="50"> 
      <div align="center"><font size="2">常数</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">出厂编号</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">制造厂家</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">精度等级</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">有无止逆</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">检定周期</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">抽检周期</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">检定日期</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">购置日期</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">购置价格</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">产权划分</font></div>
    </td>
    <td height="35" width="100"> 
      <div align="center"><font size="2">轮换日期</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">变动类别</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">工作人员</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">用户编号</font></div>
    </td>
    <td height="35" width="95"> 
      <div align="center"><font size="2">用户名称</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">所属线路</font></div>
    </td>
    <td height="35" width="95"> 
      <div align="center"><font size="2">所属站所</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">现在状态</font></div>
    </td>
    <td height="35" width="80"> 
      <div align="center"><font size="2">设备类别</font></div>
    </td>
  </tr>
  <%
  
未完

解决方案 »

  1.   

    String strSQL = "",strWhere="";
    //szsBh=new String(zsBh.getBytes(),'8859_1');" where gldw = '" + zs + "%'";
    //if (zs.length()>1)  strWhere = " where gldw like '" + zs + "%'";
    if ((startDate.length() > 1)||(endDate.length()>1)){
    if (strWhere == ""){
    strWhere = "where (jdrq >= '" + startDate + "') and (jdrq <='" + endDate +"')";
    }else{
    strWhere = strWhere + " and jdrq >= '" + startDate + "' and jdrq <='" + endDate +"'";
    }
    }
    strSQL="SELECT a.zcbh,a.lb,a.xh,a.bl,a.dy,a.dl,a.xb,a.cs,a.zzh,a.zzcj,a.jd,a.ywzn,a.jdzq,a.cjzq,a.jdrq,a.gzrq,a.gzjg,a.cqhf,a.bdrq,a.bdlb,a.gzry,a.qskh,a.xzdz,a.ssxl,a.gldw,a.xzzt,a.sblb,b.mingcheng_gds FROM jl_zc a,T_gongdiansuo b " + strWhere +zswhere; 
    //out.write(strSQL);
    ResultSet rs = DBconn.executeQuery(strSQL);
    if(rs != null){
    while(rs.next()){%>
      <tr > 
        <td height="15" width="80"><%=rs.getString(1)%>&nbsp;</td>
        <td height="15" width="110"><%=new String(rs.getString(2).getBytes(),"8859_1")%> 
          &nbsp; </td>
        <td height="15" width="80"><%=rs.getString(3)%> &nbsp;</td>
        <td height="15" width="50"><%=rs.getString(4)%> &nbsp;</td>
        <td height="15" width="80"><%=new String(rs.getString(5).getBytes(),"8859_1")%> 
          &nbsp;</td>
        <td height="15" width="50"><%=rs.getString(6) + ""%> &nbsp;</td>
        <td height="15" width="80"><%=new String(rs.getString(7).getBytes(),"8859_1")+ ""%>&nbsp;</td>
        <td height="15" width="50"><%=rs.getString(8) + ""%>&nbsp;</td>
        <td height="15" width="80"><%=rs.getString(9) + ""%>&nbsp;</td>
    <% String zzcj="";
    zzcj=rs.getString(10);
    if (zzcj==null){ 
    zzcj="";
     }
    zzcj=new String(zzcj.getBytes(),"8859_1");
    %>
        <td height="15" width="80"><%=zzcj%>&nbsp;</td>
        <td height="15" width="80"><%=rs.getString(11) + ""%>&nbsp;</td>
        <td height="15" width="80"><%=new String(rs.getString(12).getBytes(),"8859_1")%>&nbsp;</td>
        <td height="15" width="80"><%=rs.getString(13) + ""%>&nbsp;</td>
        <td height="15" width="80"><%=rs.getString(14) + ""%>&nbsp;</td>
     <% String strrq2=rs.getString(15);
    if((strrq2!=null)) 
    strrq2=strrq2.substring(0,10);
    else strrq2=" ";
    %>
        <td height="15" width="80"><%=strrq2 + ""%>&nbsp;</td>
        <% String strrq=rs.getString(16);
    if((strrq!=null)) 
    strrq=strrq.substring(0,10);
    else strrq=" ";
    %>
        <td height="15" width="80"><%=strrq+ ""%>&nbsp;</td>
        <td height="15" width="80"><%=rs.getString(17)+ ""%>&nbsp;</td>
        <td height="15" width="80"><%=rs.getString(18) + ""%>&nbsp;</td>
    <% String strrq1=rs.getString(19);
    if((strrq1!=null)) 
    strrq1=strrq1.substring(0,10);
    else strrq1=" ";
    %>
        <td height="15" width="100"><%=strrq1+ ""%>&nbsp;</td>
        <td height="15" width="80"><%=rs.getString(20) + ""%>&nbsp;</td>
        <td height="15" width="80"><%=rs.getString(21) + ""%>&nbsp;</td>
    <% String strbh=rs.getString(22);
    if((strbh!=null)) 
    strbh=strbh.substring(0,10);
    else strbh=" ";
    %>
        <td height="15" width="80"><%=strbh%>&nbsp;</td>
      <%
       String a="";
       a = rs.getString(23);
       if (a == null ) {
          a = "";
       }
       a = new String(a.getBytes(),"8859_1");
      %>
        <td height="15" width="95"><%=a+ ""%>&nbsp;</td>
    <%
       String b="";
       b = rs.getString(24);
       if (b == null ) {
          b = "";
       }
       b = new String(b.getBytes(),"8859_1");
      %>
        <td height="15" width="80"><%=b + ""%>&nbsp;</td>
    <%
       String sszs="";
       sszs = rs.getString(25);
       if (sszs == null ) {
          sszs = "";
       }
       sszs = new String(sszs.getBytes(),"8859_1");
      %>
        <td height="15" width="95"><%=sszs+ ""%>&nbsp;</td>
    <%
       String xzzt="";
       xzzt = rs.getString(26);
       if (xzzt == null ) {
          xzzt = "";
       }
       xzzt = new String(xzzt.getBytes(),"8859_1");
      %>
        <td height="15" width="80"><%=xzzt+ ""%>&nbsp;</td>
    <%
       String sblb="";
       sblb = rs.getString(27);
       if (sblb == null ) {
          sblb = "";
       }
       sblb = new String(sblb.getBytes(),"8859_1");
      %>
        <td height="15" width="80"><%=sblb+ ""%>&nbsp;</td>
      </tr>
      <%}rs.close();}%>
    </table>
    <p align="left">&nbsp;</p>
    </body>
    </html>
      

  2.   

    问个题外话,你是做电力的吧?我也是啊。也是基于j2ee构架的。
    你们公司都采用那些技术阿?  :)
      

  3.   

    用什么技术我具体不清楚,我是做硬件的,开始学软件。用的开发工具了解一些:PB、JSP等
      

  4.   

    我找出原因了SQL语句不对。谢谢上面的老师和朋友们!