<%@ page contentType="text/html; charset=GBK" %>
<%@ page language="java" import="java.io.*,java.sql.*" %>
<html>
<head>
<title>
daochu
</title>
</head><%!
public void daochu(){
Connection conn=null;
ResultSet rt=null;
try{
conn=DriverManager.getConnection("proxool.db");
}catch(Exception ex){
}
}
%> String sql="select * from tbl_user where usercode='admin'";
Statement st=conn.createStatement();
rt=st.executeQuery(sql);
if(rt.next())
{
}<body>
<table width="79" height="52">
<td>
<%=rt.getString("username")%>
</td>
</table>
</body>
</html>为什么这句 <%=rt.getString("username")%> 老是提示有问题呢?? 应该怎么改呢? 歇息俄
<%@ page language="java" import="java.io.*,java.sql.*" %>
<html>
<head>
<title>
daochu
</title>
</head><%!
public void daochu(){
Connection conn=null;
ResultSet rt=null;
try{
conn=DriverManager.getConnection("proxool.db");
}catch(Exception ex){
}
}
%> String sql="select * from tbl_user where usercode='admin'";
Statement st=conn.createStatement();
rt=st.executeQuery(sql);
if(rt.next())
{
}<body>
<table width="79" height="52">
<td>
<%=rt.getString("username")%>
</td>
</table>
</body>
</html>为什么这句 <%=rt.getString("username")%> 老是提示有问题呢?? 应该怎么改呢? 歇息俄
解决方案 »
- Connection reset by peer: socket write error怎么解决?急急
- 你们是怎么规范的??
- 如何判断用户离开了当前的页面或Session超时?
- 页面迭代复合复选框问题求助
- Double类型保留2位小数,不要四舍五入
- 在这样的代码中怎样使用欺骗手段让queryOut.jsp中的判断url程序以为是从queryIn.jsp过来的(其实不是)吗
- microsoft jdbc for sqlserver2000 result 如何将指针移到首位!!在线等急!!!
- 人事管理
- jsp连结数据库出错:HTTP Error code 405 Method Not Allowed.在线急请教!
- 如何在tomcat启动时初始化application?
- 求教<%! %>和<% %>
- sql一次删除字段在数组中的多条记录
<%if(rt.next())
{
%>
<td>
<%=rt.getString("username")%>
</td>
<%
}
%>
</table>
你可以把要显现在table表格中的内容if(rs.next()){中}<table width="79" height="52">
<td>
<% if(rt.next())
{
rt.getString("username");
}
%>
</td>
</table> 如果查询出来的数据多的话,你可以通过javaBean存到arrayList中,然后在table中显现
<%@ page language="java" import="java.io.*,java.sql.*" %>
<html>
<head>
<title>
daochu
</title>
</head><%!
public void daochu(){
Connection conn=null;try{
conn=DriverManager.getConnection("proxool.db");
}catch(Exception ex){
}
}%>
<table>
<td>
<%while(rs.next())
{%>
<%=rs.getString("username")%>
<%}%>
</td>
</table>
</html> <% %> 这个有什么规律 或者要求吗?
if(rt.next())
{
} <body>
<table width="79" height="52">
<td>
<%=rt.getString("username")%> 把<%=rt.getString("username")%>
放到 if语句里面
但是,我感觉应该把数据库驱动加上吧?如果你之前做的不用加驱动能成功的话,你就加上关闭连接试试,<%!
public void daochu(){
Connection conn=null; try{
conn=DriverManager.getConnection("proxool.db");
}catch(Exception ex){
}
}%>
<table>
<td>
<%while(rs.next())
{%>
<%=rs.getString("username")%>
<%}%>
</td>
</table> <%
try{
rt.Close();
st.Close();
conn.Close();
}catch(Exception ex){
}
%>