请问我这个DAO的SQL出现这样错误怎么查错呢!!
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '??' at line 1
为什么是2个问号,我那DAO文件根本没问号呢,还有为啥at line 1
求解啊!!!一般出现这个杂查错
新手啊!!! --------------------编程问答-------------------- debug 进去看看,传的值是什么,或者把你的那个查询的sql打印一下,看看是什么样子 --------------------编程问答-------------------- 你把你的sql贴一下吧 --------------------编程问答-------------------- 把sql语句贴出来吧 --------------------编程问答--------------------
public ArrayList<Teaching_class> getAllTeaching_class(String teId)
{
ArrayList<Teaching_class>teaching_classs=new ArrayList<Teaching_class>();
Teaching_classDAO tcDao=new Teaching_classDAO();
try
{
String sql="select * from teaching_class where teId='"+teId+"'’ ";
ResultSet rst=db.executeQuery(sql);
while(rst.next())
{
Teaching_class teaching_class=tcDao.getTeaching_classInfo(teId);
teaching_classs.add(teaching_class);
}
}
catch(SQLException ex)
{
ex.printStackTrace();
}
return teaching_classs;
} --------------------编程问答--------------------
public ArrayList<Teaching_class> getAllTeaching_class(String teId)
{
ArrayList<Teaching_class>teaching_classs=new ArrayList<Teaching_class>();
Teaching_classDAO tcDao=new Teaching_classDAO();
try
{
String sql="select * from teaching_class where teId='"+teId+"'’ ";
ResultSet rst=db.executeQuery(sql);
while(rst.next())
{
Teaching_class teaching_class=tcDao.getTeaching_classInfo(teId);
teaching_classs.add(teaching_class);
}
}
catch(SQLException ex)
{
ex.printStackTrace();
}
return teaching_classs;
} --------------------编程问答--------------------
蛋疼,贴出来我才发现有错误了 --------------------编程问答--------------------
String sql="select * from teaching_class where teId='"+teId+"'’ ";
很明显的错误· --------------------编程问答-------------------- String sql="select * from teaching_class where teId='"+teId+"'’ ";
??是teId的问题 at line1 表示执行的sql的第一行
补充:Java , Web 开发