loginpage_1.jsp

来自「图书管理系统」· JSP 代码 · 共 42 行

JSP
42
字号
<%@page contentType="text/html;charset=GBK"%>
<%@page import="java.sql.*"%>
<%
String cName="";
String cNo="";
String keyword="";
String cTel="";
request.setCharacterEncoding("GBK");
if(request.getParameter("logno")!=null)
{
 cName  =request.getParameter("logname");
 cNo    =request.getParameter("logno");
 keyword=request.getParameter("logword");
 cTel   =request.getParameter("logtel");
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(ClassNotFoundException ce)
{out.println(ce.getMessage());}
try
{
 conn=DriverManager.getConnection("jdbc:odbc:xgx");
 stmt =conn.createStatement();
 stmt.executeUpdate("INSERT INTO customer VALUES('"+cNo+"','"+cName+"','"+keyword+"','"+cTel+"')");
 out.println("注册成功!<a href=index.jsp> 回到首页</a>");
}
catch(SQLException e)
{
 out.println(e.getMessage());
}
finally
{
 stmt.close();
 conn.close();
}
}
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?