每日总结

今日关键词:修复

换了一种sql中

	public String Delete_(String name) throws Exception
	{
		Statement st=null;
		Connection conn=null;
		PreparedStatement ps=null;
		int count=0;
		Class.forName("com.mysql.cj.jdbc.Driver");
		String url="jdbc:mysql://localhost:3306/form?serverTimezone=GMT%2B8";
		String user="root";
		String password="963123963123";
		conn=DriverManager.getConnection(url, user, password);
		st=conn.createStatement();
		String sql=name;   
		try {
		sql="DELETE FROM Daka where name = '"+name+"'";
		ps=conn.prepareStatement(sql);
//		ps.setString(1, name);
		count=ps.executeUpdate();
		}catch(SQLException e) {
			e.printStackTrace();
		}finally  
		{
			if(st!=null){st.close();}
			if(conn!=null){	conn.close();}
			}
		if(count==0)return sql;
		else return "删除成功。";
	}

  

变量赋值方式

posted @ 2023-03-28 21:40  白泽的格物志  阅读(20)  评论(0)    收藏  举报