打印本文 打印本文  关闭窗口 关闭窗口
bbs的树状算法的补充程序
作者:采集员 文章来源:来源于网络 点击数: 更新时间:2005/9/10 12:59:10
ssql = "select gorders,glayer from bbs where gId=" & gId & " and goders> " & gorders & " order by goders  "
rs1.Open sql, conn1, adOpenForwardOnly, adLockOptimistic '查询比父贴
                                            ‘order_value大的order_value
If (rs1.EOF And rs1.BOF) Then
If gLayer >= 8 Then  '如果深度大于8,就设goerders,glayer跟回帖平行
   gorders = rs1("gorders")
   gLayer = rs1("glayer")
Else
  gorders = gorders + 256
  gLayer = gLayer + 1
End If
Else
  nextvalue = rs1("gorders")
  If (nextvalue - gorders) > 1 Then
   gorders = Int((gorders + nextvalue) / 2)
   gLayer = gLayer
  Else                             '跟跟贴平行
   gorders = rs1("gorders")
   gLayer = rs1("glayer")
End If
End If



打印本文 打印本文  关闭窗口 关闭窗口