尝试使用字符串字段进行记录集时出错,适用于数字

Error when trying to do record set with string field, works with numbers

我正在尝试在表单中显示一组不同的值。 当我使用数字字段时,一切正常。 尝试使用字符串字段时,出现此错误。

Microsoft VBScript 运行时错误“800a000d”
类型不匹配:'QRs(...)'
/RAY-QUICK.asp,第 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>

尝试取消数组逻辑,只循环 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