A full-featured column management program-> This is the second application of ASP.net (iv)
/*
Tofu production, are fine
Http://www.asp888.net Tofu Technology Station
If reproduced, please retain the full copyright information
*/
Let's start by showing all the articles in the column by category. Of course a paging program is very critical, we still use the message version of the use of the page of the program, in a few days I will make this into a pagelet, everyone quickly encouraged me!
Showarticle.aspx:
<!--#include file= "func.aspx"-->
<title> Browse Articles </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-->
<%
Dim Strclassid As String
Dim conn As SqlConnection
Dim sqlCmd As SQLCommand
Dim sqlread As SqlDataReader
Dim strSQL As String
Dim Intlen As Integer
Dim intreccount As Integer
Strclassid=request.querystring ("ClassID")
Conn=getconn ()
Strsql= "SELECT COUNT (*) from LANMU where classid=" & Strclassid & ""
Sqlcmd=new SQLCommand (Strsql,conn)
SqlCmd.ActiveConnection.Open ()
Sqlcmd.execute (Sqlread)
SqlCmd.ActiveConnection.Close ()
Sqlread.read ()
If CInt (sqlread (0)) =0 Then
Response.Write ("Sorry, there is no content in the current column")
Response.End
End If
Intreccount=sqlread (0)
Strsql= "SELECT * from Lanmu,lanmuclass where Lanmu.classid=lanmuclass.classid and lanmu.classid=" & Strclassid & "and lanmu.isuse= ' 1 ' ORDER BY id DESC"
Sqlcmd=new SQLCommand (Strsql,conn)
SqlCmd.ActiveConnection.Open ()
Sqlcmd.execute (Sqlread)
' Process paging display
Dim intpagecount As Integer
Dim Intstart As Integer
If IsNumeric (Request.QueryString ("Start")) Then
Intstart=cint (Request.QueryString ("Start")) ' data from this page makes position
Else
Intstart=0
End If
intlen=10 ' number of data to display per page
' The following calculates the page number of pages for the current record
if (intreccount mod intlen) =0 Then
Intpagecount=intreccount/intlen
Else
Intpagecount= (intreccount-(intreccount mod intlen))/intlen+1
End If
Dim i As Integer
' Move the resulting sqlread back to the position specified by the start
For I=0 to IntStart-1
Sqlread.read ()
Next
' Show Table page pagination bar
Writepage (Intstart, "showarticle.aspx", Intlen, Intpagecount, Intreccount)
%>
<table border=1 width=100%>
<tr>
<TD width=10% align=center> Number </td>
<TD width=50% nowrap> Theme </td>
<TD width=25% align=center> Author </td>
<TD width=25% align=center> Read times </td>
</tr>
<%
For I=0 to IntLen-1
Atend=sqlread.read ()
If not atEnd then exit for%>
<tr>
<TD align=center><%=sqlread ("id")%></td>
<td><a href= "Viewarticle.aspx?id=<%=sqlread (" id ")%>" ><%=sqlread ("title")%></a> </td>
<TD align=center><%=sqlread ("userid")%></td>
<TD align=center><%=sqlread ("Viewnum")%></td>
</tr>
<%next%>
</table>
<p></p>
</body>
This program has nothing to say, let's take a look at it. If there is anything you don't understand, don't worry, take a look at the following procedure:
viewarticle.aspx file is used to view a specific article, because of the time of the relationship, I did not put this program comments and scoring
Feature added on, Hey! I am also very sad, wait until later!
Viewarticle.aspx
<!--#include file= "func.aspx"-->
<%
Dim conn As SqlConnection
Dim sqlread As SqlDataReader
Dim sqlCmd As SQLCommand
Dim strSQL As String
Dim Strid As String
Conn=getconn ()
Strid=request.querystring ("id")
Strsql= "SELECT * from Lanmu,lanmuclass where Lanmu.classid=lanmuclass.classid and lanmu.id=" & Strid & ""
Sqlcmd=new SQLCommand (Strsql,conn)
SqlCmd.ActiveConnection.Open ()
Sqlcmd.execute (Sqlread)
If not sqlread.read () then
' No message
Echoerr ("Sorry, the current column does not have content")
End If
%>
<title> Browse Articles __ Technical column __<%=sqlread ("title")%></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-->
<script language= "VB" runat=server>
Sub Echoerr (Strerr as String)
Response.Write ("Response.Write ("Response.Write ("<title> Browse article </title>")
Response.Write (Grabpage ("/inc/head.inc"))
Response.Write ("<link rel= ' stylesheet ' type= ' text/css ' href= '"/doufu.css ' > ")
Response.Write ("Response.Write ("<body>")
Response.Write (Strerr)
Response.Write ("</body>Response.End
End Sub
</script>
Hey, pure ASP code, I have a little unbearable, but it is so, asp.net for beginners, his threshold is not high, I will be in the future not long, until everyone has already thought that the introduction, the next version of this series of articles, that time will use the pure asp.net Code, but then say again, with what method is not important, just is our request to oneself, asp.net precisely because he can make ASP programmer very easy upgrade to asp+, we just say, he really cow!
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.