ADODB.Field错误'800a0bcd'经典ASP

时间:2018-02-12 11:19:15

标签: arrays asp-classic

我在下面的代码中的if pgset中的nsql部分出错。

      un = Ns(0) 'Error Here'

我该如何解决这个问题?

帮助...

sQuery = "select * from cash where mode=1 order by id desc"
Set oRs = Dbcon.execute(sQuery)
Set Rs = Dbcon.execute(sQuery)

If Not(oRs.Eof Or oRs.Bof) then
    arrTmp = oRs.GetRows() 
        msg = ""        '로우를가져옴
else
    msg = "신청 내역이 없습니다."            '로우를가져옴
End if


If IsArray(arrTmp) Then
    pg1 = page - 1
    pg = pg1 * 20
    pgset = UBound(arrTmp, 2) - pg


    if pgset < 20 then
    For i=pg To UBound(arrTmp, 2)   '로우수만큼 for문 실행
        idx = arrTmp(7, i)
        value = FormatNumber(CDbl(arrTmp(1, i))/100,0)  
        requested = arrTmp(2, i)
        step = arrTmp(3, i) 
        uid = arrTmp(4, i)  
        uname = arrTmp(5, i)    
        uacc = arrTmp(6, i) 

        nsql = "select username from users where id = " & uid
        Set Ns = Dbcon.execute(nsql)
        un = Ns(0) 'Error Here'


        if step = "1" then
            steps = "<b style=""color:red;"">신청</b>"
        else if step = "2" then
            steps = "<b style=""color:black;"">완료</b>"
        else if step = "3" then
            steps = "<b style=""color:red;"">거절</b>"
        else
            steps = "Error"
        end if
        end if
        end if

        idxchkf = "<th><input type=""checkbox"" name=""chk_uid"" value=""" & idx & """></th>"
        idxf = "<th>" & i+1 & "</th>"
        uidf = "<th><input type=""text"" name=""uidx"" style=""width:100%;text-align:center;"" value=""" & uid & """ readonly></th>"
        unf = "<th>" & un & "</th>"
        uaccf = "<th>" & uacc & "</th>"
        valuef = "<th>" & value & "</th>"
        timef = "<th>" & requested & "</th>"
        stepf = "<th>" & steps & "</th>"
        self = "<th><input type=""radio"" name=""csh_info"" value=""1"">완료&nbsp;&nbsp;<input type=""radio"" name=""csh_info"" value=""2"">거절</th>"



        response.write "<tr>" & idxf & unf & valuef & uaccf & timef & stepf & "</tr>"

        Set Ns = Nothing

1 个答案:

答案 0 :(得分:0)

这通常表示没有从记录集返回的数据。你应该在设置变量之前检查返回的数据:

if not Ns.BOF and not Ns.EOF then un = Ns(0)