还有啊,sql="select * from space,lec where space_id="+space_id+" and lec_id="+lec_id; 其中的space_id我是通过select表lec得出它的值的啊,我现在还不知道space_id的值,怎么来space_id="+space_id呢?? 我不是很熟...大家别笑话我...
else { String space_id=rs.getString("space_id"); String ace="select * from space where space_id="+space_id; rs.close();//如果后面再试用的话. rs=mdb.executeQuery(ace);//如果后面还试用的话,另外定义以个rs1 if(rs.next()){//执行了新的查询,所以要进行判断. String ace2=rs.getString("space_name"); } }//end else %>
2.查询语句可以改成:
sql="select * from space,lec where space_id="+space_id+" and lec_id="+lec_id;当然取哪些字段还要定一下。
我写的: sql="select * from lec where lec_id='"+lec_id+"'";
我加上了分号, 你试试.
还有就是应该写成sql="select * from space,lec where space_id="+space_id+" and lec_id="+lec_id;
要么你就定义两个rs
那么以后getString什么的时候里面的字段算哪个表的呢? 如果2个表在有相同名字的字段怎么处理呢?
谢谢.
其中的space_id我是通过select表lec得出它的值的啊,我现在还不知道space_id的值,怎么来space_id="+space_id呢??
我不是很熟...大家别笑话我...
{ String space_id=rs.getString("space_id");
String ace="select * from space where space_id="+space_id;
rs.close();//如果后面再试用的话.
rs=mdb.executeQuery(ace);//如果后面还试用的话,另外定义以个rs1
if(rs.next()){//执行了新的查询,所以要进行判断.
String ace2=rs.getString("space_name");
}
}//end else
%>