jsp中的SQL插入语句怎么编写CREATE TABLE note(id int not null primary key ,title varchar(20) not null
jsp中的SQL插入语句怎么编写 CREATE TABLE note ( id int not null primary key , title varchar(20) not null , author varchar(20) not null , content varchar(50) not null ) ;
String sql = "INSERT INTO note VALUES(???????)" ; VALUES里面怎么写??
[解决办法] insert into note values(?,?,?,?)
你有两种方式:
第一种直接拼 insert into note values(1,'test','test','test')
第二种防注入的方式: insert into note values(?,?,?,?) [解决办法]
[解决办法] Connection ct=new ConnDB().getConn(); Statement sm=ct.createStatement(); sm.executeUpdate("insert into UserJSP values('"+a+"','"+a1+"','"+a2+"','"+a3+"')");