笔误,是改为: WHERE COF_NAME like '%?%'或者WHERE COF_NAME like '%Colombian%'
把生成的语句放在sqlanalyzer里执行一下看看
LIKE '%ABC%'才能找到所有包含ABC的串,没有%就什么也找不到的,所以也就无法更新了
UPDATE COFFEES SET TOTAL = 60 WHERE COF_NAME like 'Colombian' 我试过这条语句是可以执行的.
To yzhz: A strange problem, I tested the PreparedStatement with like in mysql & mssql , it worked fine. Can you tell me your db & jdbc driver? Or try: updateSales.setString(2, "%Colombian%");P.S alphazhao , with PreparedStatement, you can not set up the parameter like that: WHERE COF_NAME like '%?%'
WHERE COF_NAME like '%?%'或者WHERE COF_NAME like '%Colombian%'
我试过这条语句是可以执行的.
A strange problem, I tested the PreparedStatement with like in mysql & mssql , it worked fine. Can you tell me your db & jdbc driver?
Or try:
updateSales.setString(2, "%Colombian%");P.S
alphazhao , with PreparedStatement, you can not set up the parameter like that:
WHERE COF_NAME like '%?%'