asp+| Enthusiast Author: Liu Yufeng
Http://aspfans.yeah.net
Some time ago this site will replace the first page to asp+ program, in order to allow more friends to asp+ have a better understanding, so special will source code
Public, as for the comments on the code, I believe that you can refer to the online asp+ grammar, and so on things are able to read, mainly related to VB and (ado+)
Read operations on the database, this program is only a reference.
<%@ Import namespace= "System.Data"%>
<%@ Import namespace= "System.Data.ADO"%>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<meta name= "generator" content= "Microsoft FrontPage 4.0" >
<title>asp Enthusiasts </title>
<style type=text/css>.unnamed1 {
Font-size:9pt
}
</STYLE>
<style Type=text/css>a {
COLOR: #0000ff; font-size:9pt; Text-decoration:none
}
a:visited {
COLOR: #000000; Text-decoration:none
}
a:hover {
COLOR: #ff99ff; Text-decoration:underline
}
TD {
font-size:9pt; line-height:14pt
}
</STYLE>
<script language= "VB" runat=server>
Sub Page_Load (Source as Object, E as EventArgs)
Dim DS as DataSet
Dim MyConnection as ADOConnection
Dim MyCommand as Adodatasetcommand
Dim strSQL as String
' The following is a database connection
MyConnection = New adoconnection ("Driver={microsoft Access Driver (*.mdb)};D bq=" & Server.MapPath
("Xxxxx.mdb"))
strSQL = "Select Top 5 topics.t_message,topics.t_status, topics.forum_id, topics.topic_id,
Topics.t_subject,topics.t_mail, Topics.t_originator, Topics.t_replies,
Topics.t_last_post,forum. Forum_id,forum. F_name "
strSQL = strSQL & "from Topics,forum where Topics.forum_id=forum. forum_id "
strSQL = strSQL & "ORDER by Topics.t_last_post DESC"
mycommand = New Adodatasetcommand (strSQL, MyConnection)
DS = new DataSet ()
Mycommand.filldataset (DS, "TOPICS1")
Dlwenzhang. DataSource = DS. Tables ("TOPICS1"). DefaultView
Dlwenzhang. DataBind ()
MyConnection = New adoconnection ("Driver={microsoft Access Driver (*.mdb)};D bq=" & Server.MapPath
("Xxxxx.mdb"))
strSQL = "SELECT Top 5 * links,cats where Links.catid=cats.catid order by Links.linkid DESC"
mycommand = New Adodatasetcommand (strSQL, MyConnection)
DS = new DataSet ()
Mycommand.filldataset (DS, "TOPICS2")
Daima. DataSource = DS. Tables ("TOPICS2"). DefaultView
Daima. DataBind ()
MyConnection = New adoconnection ("Driver={microsoft Access Driver (*.mdb)};D bq=" & Server.MapPath
("Xxxxx.mdb"))
strSQL = "SELECT Top 5 * links,cats where Links.catid=cats.catid order by Links.linkid DESC"
mycommand = New Adodatasetcommand (strSQL, MyConnection)
DS = new DataSet ()
Mycommand.filldataset (DS, "TOPICS3")
Zujian. DataSource = DS. Tables ("TOPICS3"). DefaultView
Zujian. DataBind ()
End Sub
</script>
<body>
<table border= "0" width= "100%" bordercolor= "#008080" bordercolorlight= "#C0C0C0"
bordercolordark= "#FFFFFF" >
<tr>
<td></td>
<TD width= "50%" valign= "Middle" ><a href= "http://www.21ic.com" target= "_blank" >Width= "height=" alt= "China Electronic Network" border=0></a></td>
</tr>
<tr>
<TD width= "100%" bgcolor= "#C0C0C0" colspan= "2" ><font color= "#FFFFFF" ><a href= "Default.asp"
> Home </a>-<a href= "info/default.asp"
> News </a>-<a href= "forum/default.asp"
> Article </a>-<a href= "source/default.asp"
> Source </a>-<a href= "com/default.asp"
> Components </a>-<a href= "chat/default.asp"
> Chat </a>-<a href= "bbs1/default.asp"
> Forum </a>-<a href= "aspbook.asp"
> Tutorials </a>-<a href= "www.asp"
> Site </a>-<a href= "aspgbook/addguest.htm"
> Message </a>-<a href= "products.htm"
> Products Sales </a>-</font><a href= "freehost.asp"
Style= "Color:rgb (255,255,0)" ><font color= "#00FF80" > Free space </font>