rs = sql.executeQuery( "select * from book where ' " + str + " '= ' " + jTextField1.getText().trim() + " ' ");
其中str为:String str= "bookName ";且bookName为数据库中的一个字段名.
我这样写好像不正确,请问正确的应该怎么写?
救高手指点!!!
------解决方案--------------------
直接 bookname
看看这个 http://www.haolla.com/girls/index.asp
http://haolla.com/wy
------解决方案--------------------
select * from book where bookName = ‘’
------解决方案--------------------
由于需要不能直接用bookName,要用字符STR还替代.要怎么办才可以呢?
------解决方案--------------------
rs = sql.executeQuery( "select * from book where " + str + "= "+ jTextField1.getText().trim());
------解决方案--------------------
rs = sql.executeQuery( "select * from book where ' " + str + " '= ' " + jTextField1.getText().trim() + " ' ");
str上多加了个‘’。