A full-featured column management program-> This is the second application of ASP.net (v)

Source: Internet
Author: User
A full-featured column management program-> This is the second application of ASP.net (v)
/*
Tofu production, are fine
Http://www.asp888.net Tofu Technology Station
If reproduced, please retain the full copyright information
*/
Well, by the end of here, we can basically say that the social morality is complete! We can rest, we in this chapter of the content is to do a column management of the first page, the first page should include all categories of columns, the last 10 articles and the most popular 10 articles let's take a look at this originally written aspx file: default.aspx
<!--#include file= "func.aspx"-->
<script LANGUAGE=VB runat=server>
Sub Writelanmuclass ()
Dim conn As SqlConnection
Conn=getconn ()
Dim sqlCmd As SqlCommand
Dim strSQL As String
Dim sread As SqlDataReader
Strsql= "SELECT * from Lanmuclass"
Sqlcmd=new SqlCommand (Strsql,conn)
SqlCmd.ActiveConnection.open ()
Sqlcmd.execute (Sread)
Dim i As Integer
Response.Write ("<table border=1 width=100%><tr><td>")
while (Sread.read ())
Response.Write ("<a href=showarticle.aspx?classid=" & Sread ("ClassID") & ">" & Sread ("classname") & </a> (<font color=red> & Getclassnum (CStr (Sread ("ClassID")) & "</font>")
End While
Response.Write ("</td></tr></table>")
End Sub
function Getclassnum (Strclassid as String) as String
Dim conn As SqlConnection
Conn=getconn ()
Dim sqlCmd As SqlCommand
Dim strSQL As String
Dim numread As SqlDataReader
Strsql= "SELECT COUNT (*) as ccount from Lanmu where classid= '" & Strclassid & ""
Sqlcmd=new SqlCommand (Strsql,conn)
SqlCmd.ActiveConnection.Open ()
Sqlcmd.execute (Numread)
Numread.read ()
Getclassnum=numread (0)
End Function

Sub Writelastarticle ()
Dim conn As SqlConnection
Conn=getconn ()
Dim sqlCmd As SqlCommand
Dim strSQL As String
Dim sread As SqlDataReader
Strsql= "SELECT Top * from Lanmu,lanmuclass where lanmu.classid=lanmuclass.classid and lanmu.isuse= ' 1 ' ORDER BY id DESC"
Sqlcmd=new SqlCommand (Strsql,conn)
SqlCmd.ActiveConnection.open ()
Sqlcmd.execute (Sread)
Response. Write ("<p><font color=gray> recent Articles </font></p>")
Response. Write ("<table border=0 width=100%>")
while (Sread.read ())
Response. Write ("<tr>")
Response. Write ("<td width=100% align=left>")
Response. Write ("[<a href= ' showarticle.asp?classid=" & Sread ("ClassID") & "' >" & Sread ("classname") & "<" /A&GT] ")
Response. Write ("<a href= ' viewarticle.asp?id=" & Sread ("id") & "' target= ' _blank ' >" & Sread ("title") & "<" /a><font color=gray size=1> "& Sread (" Dtime ") &" </gray> ")
Response. Write ("</td>")
Response. Write ("</tr>")
End While
Response. Write ("</table>")
End Sub

Sub Writemostclick ()
Dim conn As SqlConnection
Conn=getconn ()
Dim sqlCmd As SqlCommand
Dim strSQL As String
Dim sread As SqlDataReader
Strsql= "SELECT Top * from Lanmu,lanmuclass where lanmu.classid=lanmuclass.classid and lanmu.isuse= ' 1 ' ORDER by Viewnum Desc
Sqlcmd=new SqlCommand (Strsql,conn)
SqlCmd.ActiveConnection.open ()
Sqlcmd.execute (Sread)
Response. Write ("<p><font color=gray> recent Articles </font></p>")
Response. Write ("<table border=0 width=100%>")
while (Sread.read ())
Response. Write ("<tr>")
Response. Write ("<td width=100% align=left>")
Response. Write ("[<a href= ' showarticle.asp?classid=" & Sread ("ClassID") & "' >" & Sread ("classname") & "<" /A&GT] ")
Response. Write ("<a href= ' viewarticle.asp?id=" & Sread ("id") & "' target= ' _blank ' >" & Sread ("title") & "<" /a><font color=gray size=1> "& Sread (" Dtime ") &" </gray> ")
Response. Write ("</td>")
Response. Write ("</tr>")
End While
Response. Write ("</table>")
End Sub
</script>


<title> Tofu Technology Station--> Technology column </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "Description" content= "discussion asp,php programming, introducing visual Basic, Visual C + +
The industry's latest technology and provide a free range of services including free statistical systems, free survey
and provide recruitment sites and alumni Services ">
<meta name= "Keywords" content= "discussion asp,php programming, introducing visual Basic, Visual C + +
The industry's latest technology and provide a free range of services including free statistical systems, free survey
and provide recruitment sites and alumni Services ">
<link rel= "Shortcut ICON" href= "Http://www.asp888.net/site.ico" >
<meta http-equiv= "Pragma" content= "No-cache" >
<link rel= "stylesheet" type= "Text/css" href= "/doufu.css" >

<body>
<!--advertising starts-->

<!--advertising end-->

<%WriteLanmuClass%>

<%
Writelastarticle
Writemostclick
%>

</body>


Summary: After learning a simple message version, through this slightly complex and practical application, the ASP.net programming should be said to have been basically familiar with, now this program in the Tofu technology station has been provided to download. , we also through this program, the asp.net of the pagelet for a certain understanding and use, so through this article, we have to ASP.net programming has a very basic understanding, I hope everyone is hot, familiar with the example of tofu, but also do a few of their own procedures to see!



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.