Production of pure ASP forum based on Access database (tree-shaped structure)

Source: Internet
Author: User
Tags implement integer access database
access| Data | database | Experience feeling do a forum is not as easy as imagined, but also not as complex as imagined: after 4 days of bloody battle, finally from the production of the Forum to today's forum data structure and organizational situation preliminary determination, the middle reference to the SUNAMD, Bigeagled, Liao and so on the train of thought, and got the shameless prince, Hooke,bigeagle Prawn's enthusiastic help, I would like to express thanks to this article.
Bigeagle's article uses the SQL database stored procedures to achieve, but the reality of the support of ASP free site is less, support the database free site less, support the free site SQL database ... Anyway I have not seen, who know to tell me:), so I wait for the poor only with access, I was using asp+access form to achieve a similar chinaasp forum. Talk less, and come to the other.
First of all, the structure of the database, there are two main tables, a storage user information users, a storage forum articles and information mytext. User information is needless to say, mainly is the MyText Forum article organization, to achieve the same theme of the post organization in a piece, followed by the parent post, post on the home, more important is to recognize the father affixed, otherwise will cause a layer of replies are ranked together, the second layer of reply together, three layers ... As follows:
Root Stickers
Reply 1: Root sticker
Reply 2: Root sticker
Reply: Reply 1: root stick
。。。。
So here are a few key fields:
ID (Automatic): Automatic numbering (function: show from behind)
Rootid (integer): The root of the ID (function: To achieve the same theme of the post row)
Level (integer): The number of layers of the post (function: When shown to achieve indentation)
OrderID (Single Essence): The same topic post ranking base (function: The same theme of the ranking of posts, that is, to prevent the occurrence of the case)
Fatherid (integral type): Parent sticker ID, the relationship between the posts
Sorted SQL statement:
SELECT * from MyText by Rootid desc,orderid,id desc

Implement Display Indentation (modified "Do not recursively implement tree structure ...") :
Level=0
Response.Write "<ul>"
Do as not rs.eof
If RS ("level") <level Then
For I=rs (' level ') to LEVEL-1
Response.Write "</ul>"
Next
End If
If RS ("level") >level Then
Response.Write "<ul>"
End If
Response.Write "<li> Theme: ... </li> "
Level=rs ("level")
Rs.movenext
Loop
Response.Write "</ul>"
%>
Note: The original "No recursive implementation of the tree structure ..." The article is wrong, this is the modified code.

Also have a little experience to note: It is in the single fine type data transfer value, such as: Orderid,request up the data to first replace (OrderID, "", "+"), and then csng conversion, or will report "Type Mismatch", I began to baffled, Later found in the value of the time will be a single fine data "+" to be lost, to become a space, so first to replace the transition.

The above is only my personal view, if there are errors or a better way to welcome the exchange of gwlx@21cn.com, we can go to 211.90.159.61 (Opening time: 8:15~17:30) or Http://www.21union.net/sqlbbs see examples and a lot of irrigation yo:).



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.