寻龙夺宝主题曲:为什么同一段sql语言会产生不同的id号?

来源:百度文库 编辑:高校问答 时间:2024/04/27 19:42:31
<%
sql = "select id,content from element where num='10-6' and dept='" + deptno + "' order by index_n";
rs= stmt.executeQuery(sql);
if(rs.next()){
int id = rs.getInt("id");
String content = rs.getString("content");
if (content.length()>360){
%>
<a href="yxdhinfon.jsp?id=<%=id%>"><%=content.substring(0,360)%>...</a>
<%
}
else{
%>
<a href="yxdhinfon.jsp?id=<%=id%>"><%=content%></a>
<%
}
}
rs.close();
%>

这段语言在两个文件内出现,竟然显示了两个不同的id号,为什么
是不是还要加什么代码,请大家告诉,谢谢。
请问deptno是什么

那一定是deptno不同啦

deptno是你程序里的一个变量吧,通过它来查找不同的dept 的植,你在程序里搜一下它找找它具体代表什么变量就行了.

deptno值不同呗