用SQL Server查询所有数据并显示
利用SQL Server查询数据,并把所有数据显示在页面上。
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="jdbc.sqlServer"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.sql.ResultSet"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'LinDao.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
<!-- 查询管理员信息 --> <div>
<table border=1px style="width:500px;height:200px;text-align:center;margin: 0 auto;margin-top:0px"> <div style="width:500px;height:40px;border:1px solid red;margin:0 auto;text-align:center;margin-top:60px;background:#fff;margin-top:-2px">
<font color="red" font-weight="bold">管理员信息</font> </div>
<tr style="background:red"> <td>编号</td>
<td>姓名</td>
<td>元宝数</td>
<td>删除</td> </tr> <% //引用连接数据库方法
sqlServer sq1=new sqlServer();
//得到数据库连接
Connection con1 = sq1.getConnection();
//编写sql语句
String sql1="select * from Admin"; //得到数据库对象操作
Statement st1=con1.createStatement();
// 得到查询的结果
ResultSet rs1 = st1.executeQuery(sql1); while(rs1.next()){ %> <tr>
<td> <%out.print(rs1.getInt(1) + "\t"); %></td> <td> <%out.print(rs1.getString(2) + "\t"); %></td> <td> <%out.println(rs1.getInt(3)+ "\t"); %></td>
<td> <a href="time.jsp?id=<%out.print(rs1.getInt(1) + "\t"); %>">删除</a></td> </tr><%
} //释放资源
sq1.ShiFang(rs1,st1,con1); %>
</table>
</div> </body>
</html>
用SQL Server查询所有数据并显示的更多相关文章
- sql server 查询某个表一直显示"正在执行中..."的问题
问题描述:只是单纯的执行了"select count(*) from 某表":数据表中只有一两条数据,能查询其他表,唯独这个表不能进行任何操作: 经百度搜索实验,发现应该是某个进程 ...
- SQL Server查询重复数据
1.查询单列重复: select * from test where name in (select name from test group by name having count (name) ...
- SQL SERVER 查询所有数据表名称和数据行数
SELECT a.name, b.rows FROM sysobjects AS a INNER JOIN sysindexes AS b ON a.id = b.id WHERE ( a.type ...
- 面试1 SQL SERVER 查询第20行到30之间的数据
SQL SERVER 查询第20行到30之间的数据 1.先查询前20行的ID,后查询除去20条记录的前10条记录 SELECT TOP 10 * FROM tbBank WHERE BankID NO ...
- [转] 利用SET STATISTICS IO和SET STATISTICS TIME 优化SQL Server查询性能
首先需要说明的是这篇文章的内容并不是如何调节SQL Server查询性能的(有关这方面的内容能写一本书),而是如何在SQL Server查询性能的调节中利用SET STATISTICS IO和SET ...
- SQL SERVER 查询性能优化——分析事务与锁(五)
SQL SERVER 查询性能优化——分析事务与锁(一) SQL SERVER 查询性能优化——分析事务与锁(二) SQL SERVER 查询性能优化——分析事务与锁(三) 上接SQL SERVER ...
- 一个有趣的SQL Server 层级汇总数据问题
看SQL Server大V宋大侠的博客文章,发现了一个有趣的sql server层级汇总数据问题. 具体的问题如下: parent_id emp_id emp_nam ...
- 利用SET STATISTICS IO和SET STATISTICS TIME 优化SQL Server查询性能
首先需要说明的是这篇文章的内容并不是如何调节SQL Server查询性能的(有关这方面的内容能写一本书),而是如何在SQL Server查询性能的调节中利用SET STATISTICS IO和SET ...
- SQL Server :理解数据页结构
原文:SQL Server :理解数据页结构 我们都很清楚SQL Server用8KB 的页来存储数据,并且在SQL Server里磁盘 I/O 操作在页级执行.也就是说,SQL Server 读取或 ...
随机推荐
- 【模板】Tarjan缩点
洛谷3387 #include<cstdio> #include<algorithm> #include<cstring> using namespace std; ...
- SSL/TLS 协议介绍
SSL/TLS 协议(RFC2246 RFC4346)处于 TCP/IP 协议与各种应用层协议之间,为数据通讯提供安全支持. 从协议内部的功能层面上来看,SSL/TLS 协议可分为两层: 1. SSL ...
- 【Codeforces 1114C】Trailing Loves (or L'oeufs?)
[链接] 我是链接,点我呀:) [题意] 问你n!的b进制下末尾的0的个数 [题解] 证明:https://blog.csdn.net/qq_40679299/article/details/8116 ...
- ZOJ 3687 The Review Plan I
The Review Plan I Time Limit: 5000ms Memory Limit: 65536KB This problem will be judged on ZJU. Origi ...
- CDOJ 889 Battle for Silver
Battle for Silver Time Limit: 2999/999MS (Java/Others) Memory Limit: 65432/65432KB (Java/Others) ...
- FORTIFY_SOURCE
In recent years Linux distributions started treating security more seriously. Out of many security f ...
- Fedora15下安装Android开发环境
Fedora15下安装Android开发环境需要以下步骤: 完整步骤. 1. 安装正确版本的JDK. 2. 安装Eclipse. 3. 安装ADT. 4. 安装Android SDK. 5. 安 ...
- VI 快捷操作 【持续更新】
2014-9-23 一. 大小写转换 vim中大小写转化的命令是 gu或者gU 形象一点的解释就是小u意味着转为小写:大U意味着转为大写. 剩下的就是对这两个命令的限定(限定操作的行,字母,单词) ...
- Color the ball 线段树 区间更新但点查询
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> #inclu ...
- PHP array_diff_assoc()
定义和用法 array_diff_assoc() 函数返回两个数组的差集数组.返回的数组的元素都取自被比较的数组(既第一个数组). 和 array_diff() 函数 不同,本函数要求键名和键值都进行 ...