猿问

始终是报这个错误"Syntax error, insert "Finally" to complete TryStatement"

<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%>

<%

String path = request.getContextPath();

String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

 

  

  <body>

   <form action="" method="post">

   产品号:<input type="text" name="number">

   <input type="button" value="删除">

   </form>

   <% String number = request.getParameter("number");

      if(number != null && !"".equals(number)){

      Connection con;

      Statement sql;

      ResultSet rs;

      try{ 

           Class.forName("com.mysql.jdbc.Driver");

        }catch(Exception e){

        }

        try{

            String uri = "jdbc:mysql://127.0.0.1:3306/warehouse";

String user = "root";

String password = "";

con = DriverManager.getConnection(uri, user, password);

//也可以写成con=DriverManager.getConnection(uri+"?user=root&password=");

sql = con.createStatement();

rs = sql.executeQuery("DELETE * FROM product where number='"

+ number + "'");

con.close();

}

 

             

}

%>

 

  </body>

</html>


枫夜流萤
浏览 2564回答 1
1回答

5E

try代码部分没有finally部分,加上试试
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答