JSP中的数据库查询

2025-12-16 01:55:53
推荐回答(2个)
回答1:

rs = sql1.executeQuery("select * from table1 where 编号 ="+变量名);
这样写就可以了
如果编号是字符型那就得这样写
rs = sql1.executeQuery("select * from table1
where 编号 ='"+变量名+"'");

回答2:

int iBianHao;
rs = sql1.executeQuery("select * from table1 where 编号 = "+iBianHao);
String strBianHao
rs = sql1.executeQuery("select * from table1 where 编号 = '"+strBianHao+"'");