我的SELECT语句一直有效,直到我添加一个WHERE参数。 当我添加WHERE参数时,我得到500错误。 同样,除非我将一个WHERE参数添加到select语句中,否则这个工作正常。
<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
Dim db_path
Dim db_dir
db_dir = Server.MapPath("/private") & "\"
db_path = db_dir & "Database.mdb"
conn.Open db_path
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT DISTINCT Group, Finish FROM Parts WHERE Group = 'Exhaust'"
rs.Open sql, conn
%>
<table border="1" width="100%">
<%response.write(sql)%>
<tr>
<%for each x in rs.Fields
response.write("<th>" & x.name & "</th>")
next%>
</tr>
<%do until rs.EOF%>
<tr>
<%for each x in rs.Fields%>
<td><%Response.Write(x.value)%></td>
<%next
rs.MoveNext%>
</tr>
<%loop
rs.close
conn.close%>
</table>
</body>
</html>
答案 0 :(得分:-1)
我修好了。 如果我将select语句更改为:
,它可以工作sql="SELECT DISTINCT Group, Finish FROM Parts WHERE (((Group)='Exhaust'));"