我试图在表单中显示一组不同的值。 当我使用数字字段时,一切正常。 尝试使用字符串字段时,我收到此错误。
Microsoft VBScript runtime error '800a000d' Type mismatch: 'QRs(...)' /RAY-QUICK.asp, line 92
<option selected value="0"> - Ft_ProdCode - SQL tekst </option>
<% ' ----------------------------------------------- START SQL QUERY
Set MyConn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("/db/quickd.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
SQL_Query = "SELECT DISTINCT Quick.[Ft_ProdCode] FROM Quick;"
Set RS = MyConn.Execute(SQL_query)
If Not Rs.EOF Then
QRs = Rs.GetRows()
QaantVelden = UBound(QRs):QaantRecords = UBound(QRs, 2)
Else
AnaantRecords = -1
End If
Rs.Close
Set Rs = Nothing
myConn.Close
Set myConn = Nothing
DeCEL=0 : do while DeCEL<>Qaantrecords+1
if QRS(0,deCEL )>0 then
%>
<option value="<%=QRS(0,deCEL )%>"><%=QRS(0,deCEL )%></option>
<% end if
DeCEL=DeCEL+1 : loop : DeCEL=0
%>
</select>
答案 0 :(得分:0)
尝试取消数组逻辑,只需循环rs:
Set MyConn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("/db/quickd.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
Set RS = MyConn.Execute("SELECT DISTINCT Quick.[Ft_ProdCode] FROM Quick;")
do while not RS.eof
response.write("<option value=""" & RS("Ft_ProdCode") & """>" & RS("Ft_ProdCode") & "</option>")
RS.movenext
loop
Rs.Close
Set Rs = Nothing
myConn.Close
Set myConn = Nothing