再Java编程问题

来源:百度知道 编辑:UC知道 时间:2024/06/15 02:37:51
stmt.executeUpdate("select * from t_classroom where t_num=25 and t_media='N'");总是出错,经过测试,当删除and t_media='N'时才能查询正确,其中t_media字段为文本型,请问该如何修改该语句?

试试and t_media=\'N\'

方法使用错了 这个方法是增删改的
而你要查询 使用executeQuery()
这个是查询的
换一下试试

查询语句使用executeQuery方法,你使用的方法是更新数据库的

executeQuery()