ASP multi-Column Display Information

Source: Internet
Author: User

You can set your own style
Dim maxcount' number of information to be displayed
Maxcount = 10
Dim linecount 'specifies the number of information displayed for a row.
Linecount = 4
'Determine the number of existing information items in the database
SQL = "select * from news where bigclassname = 'Company dynamics '"
Set rs = server. Createobject ("ADODB. recordset ")
Rs. Open SQL, Conn, 1, 1
Dim RC
Rc = Rs. recordcount

Response. Write ("<Table width = '000000' Height = '000000' border = '0'> ")

'Judge whether the data in the database is less than maxcount. If it is less, it will be displayed in one row.
If RC <= linecount then
Response. Write ("<tr> ")
Do while not Rs. EOF
Response. Write ("<TD>" & RS ("title") & "</TD> ")
Rs. movenext
Response. Write ("</tr> ")
Rs. Close
Set rs = nothing

'Database data is larger than maxcount
Dim fuzhu
Fuzhu = 0
Rs. Close
Set rs = nothing
Sql1 = "select top" & maxcount & "* from news where bigclassname = 'Company dynamics '"
Set RS1 = server. Createobject ("ADODB. recordset ") sql1, Conn, 1, 1

Response. Write ("<tr> ")
Do while not rs1.eof
If fuzhu mod linecount = 0 then
Response. Write ("</tr> <tr> ")
End if
Response. Write ("<TD>" & RS1 ("title") & "</TD> ")
Fuzhu = fuzhu + 1

Set RS1 = nothing
Response. Write ("</tr> ")

End if

Response. Write ("</table> ")

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: 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.