各位大虾,帮忙看看,程序是想从数据库2个表中求2个列的和,再求2个列之和的差,然后输出显示
现在程序能运行,就是求出来的值不正确,麻烦大虾多多指点
<%@page contentType="text/html;charset=Gb2312"
import="java.sql.*"%>
<html>
<head>收支统计功能
</head>
<body>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:b");
Statement stmt=con.createStatement();
String CXJB="SELECT SUM(sr) AS t1,SUM(zc) AS t2,t1-t2 AS t FROM b2,b3";
ResultSet rs;
rs=stmt.executeQuery(CXJB);
%>
<table align=center bgcolor=Dodgerblue>
<tr begcolor=skyblue>
<td><b>收支总合为</b></td>
</tr>
<%
while(rs.next())
{
%>
<tr bgcolor=lightgoldenrodyellow>
<td><b><%=rs.getString("t")%></b></td>
</tr>
<%
}
%>
</table>
<P></P>
<%
rs.close();
stmt.close();
con.close();
%>
<p>继续统计!点击
<A HREF=jsgn.htm>返回</A></p>
</body>
</html>