0
我正在網站中添加博客。那樣的工作就好像我將通過查詢字符串的幫助點擊標題鏈接,標題爲desc,img的頁面將會顯示。但在此特定時間循環執行兩次。 這裏是我的代碼,請幫助。循環和查詢正在執行兩次
Private Sub sbloadBlog()
Try
Dim unqstr As String = Request.QueryString("id").ToString()
unqstr = unqstr.Substring(0, unqstr.IndexOf("-"))
Dim x As String = "select distinct Title as url, img, blog_desc from Blog_Gallery_AYS where unqid ='" + unqstr + "'"
Dim dt As New DataTable
dt = Dal.GettDS(x).Tables(0)
x = ""
x += "<p>"
For Each dr As DataRow In dt.Rows
x += "<h2>'" + dr("url") + "'</h2>"
x += "<p>'" + dr("blog_desc") + "' </h2>"
x += "</br>"
x += "</br>"
x += "<img src='" + dr("img").ToString().Replace("~/", "") + "'/>"
Next
x += "</p>"
x += x.Replace("'", """")
divblogdetail.InnerHtml = x
Catch ex As Exception
End Try
End Sub
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Request.QueryString("id") Is Nothing Then
sbloadBlog()
End If
End Sub
「If not me.IsPostBack」perform sbloadBlog()? – Caveman