?? deleteuser2.jsp
字號:
<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<%//接收要刪除的用戶ID號
long user_id;
try
{
user_id=Long.parseLong(request.getParameter("user_id"));
}
catch(Exception e)
{
user_id=0;
}
%>
<%//構造追加記錄SQL語句
String sqlString=null;//SQL語句
if(user_id!=0)//接收到的參數正確
{
sqlString="delete from userTable where user_id="+user_id;
//執行SQL語句
try
{ Connection con;
Statement sql;
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=testDatabse","sa","");
sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
sql.executeUpdate(sqlString);
con.close();
}
catch(SQLException e1)
{
out.print("SQL異常!");
}
}
%>
<head>
<title>用戶注冊程序</title>
</head>
<body>
<center>
<table border="1" width="700">
<tr>
<td width="100%" colspan="2" align="center">刪除用戶程序</td>
</tr>
<tr>
<td width="100%" colspan="2">刪除用戶成功!</td>
</tr>
</table>
</center>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -