Dim ordervalue, nextvalue As Double sql = "select gorders where gId=" & gId & " and goders> " & gorders & " order by goders " rs1.Open sql, conn1, adOpenForwardOnly, adLockOptimistic '查询比父贴大的 order_value If (rs1.EOF And rs1.BOF) Then gorders = gorders + 256 gLayer = gLayer + 1 Else nextvalue = rs1("gorders") If (nextvalue - gorders) > 1 Then gorders = Int((gorders + nextvalue) / 2) gLayer = gLayer Else 'gorders,glayer跟回帖一样 End If End If