帮我看看这段代码有什么问题,往数据库里写数据,报错:stmt cannot be resolved,这是什么原因???
<%@ page contentType= "text/html; charset=gb2312 " %>
<%@ page info= "database handler "%>
<%@ page import= "java.io.* "%>
<%@ page import= "java.util.* "%>
<%@ page import= "java.sql.* "%>
<%@ page import= "javax.servlet.* "%>
<%@ page import= "javax.servlet.http.* "%>
<html>
<head> <title> jsp page </title> </head>
<body>
<%
String SQLDriver= "com.microsoft.jdbc.sqlserver.SQLServerDriver "; String SQLURL= "jdbc:microsoft:sqlserver://localhost:1433; DatabaseName=simple ";
Connection Con;
Statement Stmt;
try
{
try
{
Class.forName(SQLDriver).newInstance();
}
catch(java.lang.ClassNotFoundException e)
{
out.print( "Connect to Database error: " + e.getMessage());
}
try
{
Con=DriverManager.getConnection(SQLURL, "sa ", "sql ");
}
catch(SQLException e)
{
out.print(e.toString());
}
Stmt=Con.createStatement();
String name=new String(request.getParameter( "name ").getBytes( "8859_1 "));
String tel=new String(request.getParameter( "tel ").getBytes( "8859_1 "));
String email=new String(request.getParameter( "email ").getBytes( "8859_1 "));
String query1= "insert into simple(name,tel,email)values
( ' "+name+ " ', ' "+tel+ " ', ' "+email+ " ') ";
stmt.executeUpdate(query1);
stmt.close();
con.close();
}
catch (SQLException e){}
out.println( "添加成功 ");
%>
</body>