rs.Open "select id from neirong where title='" & .TextMatrix(.Row, 4) & "'", cn
If Not rs.BOF Then
Dim i As Integer
dim aa as variant
For i = 1 To b
AA(i) = rs("id")  '报错 subscript out of range
Next
End If
rs.Close

解决方案 »

  1.   

    b 多大?是不是数组溢出了??和数据库关系不大!好象是ASP代码吧!到ASP版本问问看.
      

  2.   

    b
    AA
    的定义语句?
      

  3.   

    rs.Open "select id from neirong where title='" & .TextMatrix(.Row, 4) & "'", cn
    If Not rs.BOF Then
    Dim i As Integer
    dim aa as variant
    dim AA()
    redim AA(b)
    For i = 1 To b
    AA(i) = rs("id")  '报错 subscript out of range
    Next
    End If
    rs.Close使用数组前要给数组定义大小
      

  4.   

    --VB代码,使用数组前要先定义,并初始化其大小,否则会提示“下标越界”dim AA()
    redim AA(b)    --其中b为数组的大小
      

  5.   

    把dim aa as variant
    改成dim aa() as int试试
      

  6.   

    dim AA()
    redim AA(b)    --其中b为数组的大小
    顶这个,