求助,ASP多表查找显示问题
在设备申请表(表中有设备编号、部门编号、设备数量,没有设备名称,部门名称)中找到符合审核通过条件的数据,还要在设备表、部门表里查找相应的设备名称、部门名称,最后输出列表,显示设备名称,部门名称,设备数量三种数据,原先只是简单实现了把申请表中通过审核的数据输出,后来用ACCESS生成了联合查询的语句,放进去,连页面都显示不出来,HTTP500错误原先代码如下,能显示符合条件的设备编号,部门编号,数量
<%
strSQL = "SELECT * FROM ml_Apply WHERE IsAudi = '通过审核' ORDER BY DeptID Desc"
rsResult.Open strSQL,strConn,adOpenKeyset,adLockReadOnly
If Not rsResult.Eof And Not rsResult.Bof Then
DeptID = rsResult("DeptID")
MachineryID = rsResult("MachineryID")
number = rsResult("number")
%>
<tr bgcolor="#FFFFFF">
<td width="20%" align="left"><div align="left"><% =DeptID%></div></td>
<td width="30%" align="left"><div align="left"><% =MachineryID%></div></td>
<td width="30%" align="left"><div align="left"><% =number%></div></td>
</tr>
<%
rsResult.MoveNext
If rsResult.EOF Then Exit For
Next
End If
rsResult.Close
Set rsResult = Nothing
%>
后来改的的代码
<%
strSQL = "SELECT ml_Dept.DeptName, ml_Machinery.MachineryName, ml_Apply.Number
FROM (ml_Apply INNER JOIN ml_Machinery ON ml_Apply.MachineryID = ml_Machinery.MachineryID) INNER JOIN ml_Dept ON ml_Apply.DeptID = ml_Dept.DeptID
WHERE (((ml_Apply.IsAudi)="通过审核"))"
rsResult.Open strSQL,strConn,adOpenKeyset,adLockReadOnly
If Not rsResult.Eof And Not rsResult.Bof Then
DeptID = rsResult("ml_Dept.DeptID")
MachineryID = rsResult("ml_Machinery.MachineryID")
number = rsResult("ml_Apply.number")
%>
谁教教我到底该怎么写啊