Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate » MS SQL  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 查询数据库查询出错,请高用指点!
linkeca





发贴: 15
积分: 0
于 2005-10-26 17:00 user profilesend a private message to usersend email to linkecasearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
查询书目程序:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page import="java.sql.*" contentType="text/html;charset=GB2312" %>
<jsp:useBean id="pool" scope="session" class="text.check"/>
<%request.setCharacterEncoding("gb2312");%>
<html>
<head>
  <title>查询结果</title>
</head>
<body>
<%
ResultSet rs1,rs2;
String search_str,sql1,temp,choice;

String SearchType=request.getParameter("SearchType");
//int i=stringToInt(SearchType);
int i=1;
choice=request.getParameter("match_flag");
search_str=request.getParameter("search_str");

//SearchType=request.getParameter("SearchType");
Integer p=Integer.valueOf(SearchType);
i=p.intValue();
if(choice=="0")
temp=search_str+"%";
else
temp="%"+search_str+"%";
String str1;
switchLight Bulb
{
case 1://书名;
  sql1="select * from book_msg where book_name like '"+temp+"'";
  break;
case 2://作者
  sql1="select * from book_msg where book_author like '"+temp+"'";
  break;
case 3://出版社
  sql1="select * from book_msg where book_publisher like '"+temp+"'";
  break;
case 4://分类号
  sql1="select * from book_msg where book_type like '"+temp+"'";
  break;
default:
  sql1="select * from book_msg";
  
}
pool.getSQL(sql1);
rs1=pool.buildlink();
%>
<table border="1">
<tr>
<td>图书编号</td>
<td>图书名</td>
<td>图书状态</td>
<td>作者</td>
<td>出版社</td>
<td>还书时间</td>
</tr>
<%
while(rs1.next())
{
  %><tr><%
  %><td><%=rs1.getString("book_id")%>    </td><%
  %><td><%=rs1.getString("book_name")%>    </td><%
  if(rs1.getInt("book_state")==1)
  %><td>借出  </td><%
  else
  %><td>在馆  </td><%
  %><td><%=rs1.getString("book_author")%>    </td><%
  %><td><%=rs1.getString("book_publisher")%>    </td><%
  %><td><%=rs1.getString("book_returntime")%>    </td><%
  %></tr><%
}
%></table><%
%>
</body>
</html>

出错信息:
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: [Microsoft][ODBC SQL Server Driver]无效的描述符索引
  org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
  org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
  org.apache.jsp.shumuchaxun.forsearch_jsp._jspService(forsearch_jsp.java:167)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
  javax.servlet.http.Http

Servlet.service(HttpServlet.java:802)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:802)




一个程序员的奋斗历程

话题树型展开
人气 标题 作者 字数 发贴时间
7564 查询数据库查询出错,请高用指点! linkeca 2841 2005-10-26 17:00
5881 Re:查询数据库查询出错,请高用指点! 沙漠小鸟 5 2005-10-26 18:06
5982 Re:查询数据库查询出错,请高用指点! linkeca 21 2005-10-27 12:55
6576 Re:查询数据库查询出错,请高用指点! pp_car 90 2005-10-30 14:04

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923