日期:2014-05-18  浏览次数:20622 次

jsp连接mysql的问题
<%@   page   language= "java "   contentType= "text/html;   charset=gbk "%>
<%@   page   pageEncoding= "gbk "%>
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN ">
<%@page   import= "java.sql.Connection "%>
<%@page   import= "thisBeans.DatabaseBean "%>
<%@page   import= "java.sql.Statement "%>
<%@page   import= "java.sql.ResultSet "%>
<%@page   import= "java.sql.ResultSetMetaData "%>
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gbk ">
<title> This   is   a   test </title>
</head>
<body>
<%
Connection   conn=DatabaseBean.getConnection();
String   sql= "select   max_id   from   tableseq   where   table_name= 'category ' ";
//int   i=DatabaseBean.getMaxId( "category ");
Statement   stmt=conn.createStatement();
ResultSet   rs=stmt.executeQuery(sql);
ResultSetMetaData   rsmd=rs.getMetaData();
int   i=rsmd.getColumnCount();
String   str=rsmd.getColumnTypeName(1);
%>
<%=rs.getInt(1)   %>
数据库可以连接,也可以进行操作,但就是最后那句 <%=rs.getInt(1)   %> 差不出结果,   求高人指点

------解决方案--------------------
<%=rs.getInt( "max_id ")%>
------解决方案--------------------
max_id 是 int 类型?