JSP课件以及一个网上书店系统程序,带数据库

源代码在线查看: display.jsp

软件大小: 9801 K
上传用户: suroot2005
关键词: JSP 程序 数据库
下载地址: 免注册下载 普通下载 VIP

相关代码

				
				
				
				
				
				
				
				
				
				查询结果如下:
				
								   try{
				     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
				     String url="jdbc:odbc:saloryDSN";
				     String user="admin";
				     String password="";
				     Connection conn=DriverManager.getConnection(url,user,password);
				     Statement stmt=conn.createStatement();
				     stmt.setMaxRows(10);
				     String query=request.getParameter("query");
				     out.print(query);
				     ResultSet rs=stmt.executeQuery(query);
				     ResultSetMetaData rsmd=rs.getMetaData();
				     int cols=rsmd.getColumnCount();
				     out.println("");
				     out.println(""); 
				     for(int i=1;i				     {
				       out.print("");
				       out.print(rsmd.getColumnLabel(i));
				       out.println("");
				     }
				     out.print("");
				     while(rs.next()){
				       out.print("");
				       for(int i=1;i				         out.print("");
				         Object obj=rs.getObject(i);
				         if(obj!=null)
				            out.print(obj.toString());
				         else
				            out.print("");
				         out.println("");
				       }//end of for
				       out.print("");
				     }//end of while
				     out.print("");
				     rs.close();
				     stmt.close();
				     conn.close();
				   }
				    catch(ClassNotFoundException ex){
				         out.println(ex.getMessage());
				     }
				     catch(SQLException ex){
				         out.println(ex.getMessage());
				    }
				   %>
				   下一个查询
				
				
							

相关资源