每一个帖子的第一条评论记录无法在页面上输出??

来源:百度知道 编辑:UC知道 时间:2024/06/05 21:47:57
下面是这个功能的代码:
Dim plSql As String
plSql = "Select comment.comment_id, comment.comment_content, comment.comment_date, comment.comment_user From comment Where comment.gushi_id =" & request.querystring("id")
Dim PlCmd As New OleDbCommand(plSql, myConn)
Dim plDr As OleDbDataReader = PlCmd.ExecuteReader()
If plDr.Read = False Then
comment.Text = "     还没有人对这个故事发表感想"
Else
comment.Text = "<table border='0' cellpadding='0' cellspacing='0' width='93%'>"
Dim f As Integer
f = 0
Do While plDr.Read()
f = f + 1
comment.Text &= "<tr>"
comment.Text &= "<td style='height:20px;width:15px'>" & "</td>"
comment

If plDr.Read = False Then 这句就已经read一次了,所以没有第一行。
不要做if判断,直接用while。然后在后面判断f值,如果f=0那么就输出你那句就可以了