Simple Example of ASP + Ajax implementation without refreshing comments

Source: Internet
Author: User

<! -- # Include file = "command. asp" -->
<%
Dim CurPage
CurPage = cint (Request ("page "))
If CurPage = empty or CurPage <1 Then
CurPage = 1
End If
Response. ContentType = "application/xml"
Response. Charset = "gb2312"
Response. Expires = 0
Response. Write ("<? Xml version = "" 1.0 "" encoding = "" gb2312 ""?> ")
Dim rs and SQL 'define database connection objects
Set rs = Server. CreateObject ("ADODB. Recordset ")
SQL = "SELECT * From rev Order by id Desc"
Rs. Open SQL, Conn, 1, 3
IF rs. Eof And rs. Bof Then
Response. Write ("<data page =" 0 "" P_Nums = "" 0 "> ")
Response. Write ("<Content> no message </Content> ")
Response. Write ("</data> ")
Response. End
Else
Dim PerPage, P_Nums, PageCountN, D_Nums
PerPage = 3
Rs. PageSize = PerPage
Rs. AbsolutePage = CurPage
P_Nums = Rs. PageCount
D_Nums = Rs. RecordCount
Response. write ("<data page =" "& CurPage &" P_Nums = "& P_Nums &" D_Nums = "& D_Nums &">")
Do Until rs. EOF or PageCountN = PerPage
Response. Write ("<Author PostTime =" & formatTime (rs ("PostTime") & ""> <! [CDATA ["& rs (" memContent ") &"]> </Author> ")
Response. Write ("<Content> <! [CDATA ["& rs (" memContent ") &"]> </Content> ")
Rs. MoveNext
PageCountN = PageCountN + 1
Loop
End If
Response. Write ("</data> ")
%>
Package File Download

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.