在sql中使用like的时候,
select *
from student
where name like '%studentname%'如果这里的studentname是一个变量该怎么写啊?
是不是 where name like '"&studentname&"%'
如果是这样的话为什么在Java中总是说:
Severity and Description Path Resource Location Creation Time Id
The operator & is undefined for the argument type(s) java.lang.String, java.lang.String FindGoods/src/db dbOperation.java line 38 1214359093031 3171
这样的错误啊?
select *
from student
where name like '%studentname%'如果这里的studentname是一个变量该怎么写啊?
是不是 where name like '"&studentname&"%'
如果是这样的话为什么在Java中总是说:
Severity and Description Path Resource Location Creation Time Id
The operator & is undefined for the argument type(s) java.lang.String, java.lang.String FindGoods/src/db dbOperation.java line 38 1214359093031 3171
这样的错误啊?
楼主【monkeycug1】截止到2008-06-25 10:03:08的历史汇总数据(不包括此帖):
发帖数:29 发帖分:430
结贴数:1 结贴分:10
未结数:28 未结分:420
结贴率:3.45 % 结分率:2.33 %
from student
where name like '%" +studentname + "%'"sql这样
where name like '%"+ studentname +"%'
就ok了!
字符串拼接"select * from student where name like '%"+studentname+"%'"
studentname就是变量