JDBC中sql语句需要变量时双引号和单引号的用法

参考:https://blog.csdn.net/wang_shuai_long/article/details/51753906

 按照变量与字符串连接的规则,给变量两边加上+号,然后在加号之前或之后的双引号前加上单引号
			String sql = "INSERT INTO users(id, username, password, gender, telephone, introduce)" + "VALUES('"+ user.getId()+ "','"
			+ user.getUsername() 
			+ "','" 
			+ user.getPassword() 
			+ "','" 
			+ user.getGender() 
			+ "','" 
			+ user.getTelephone() 
			+ "','" 
			+ user.getIntroduce() 
			+ "')";

 

你可能感兴趣的:(JAVA,WEB)