前一段时间本站将首页更换为了ASP+程序,为了能让更多的朋友对asp+有更好的了解,所以特将源代码
公开,至于对代码的注释,相信大家参考现在网上的asp+语法之类的东东都能看懂,主要涉及到VB与(ADO+)
对数据库进行读取操作,此程序仅仅作为一个参考。
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ADO" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<title>ASP爱好者</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
'以下是数据库联结
MyConnection = New ADOConnection("Driver={Microsoft Access Driver (*.mdb)};DBQ=" & 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)};DBQ=" & server.mappath
("XXXXX.mdb"))
strSql ="SELECT top 5 * FROM 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)};DBQ=" & server.mappath
("XXXXX.mdb"))
strSql ="SELECT top 5 * FROM 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>
</head>
<body>
<table border="0" width="100%" bordercolor="#008080" bordercolorlight="#C0C0C0"
bordercolordark="#FFFFFF">
<tr>
<td><img src=http://www.jiafangren.com/uploads/allimg/201011/0AS56312-0.gif" width="400" height="60" alt="aspfans.gif (12099 bytes)"></td>
<td width="50%" valign="middle"><a href="http://www.21ic.com" target="_blank"><img src=http://www.jiafangren.com/uploads/allimg/201011/0AS5F42-1.gif"
width="350" height="50" alt="中国电子网" border=0></a></td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0" colspan="2"><font color="#FFFFFF"><a href="default.asp"
>本站首页</a> - <a href="info/Default.asp"
>新闻</a> - <a href="forum/default.asp"
>文章</a> - <a href="source/default.asp"
>源码</a> - <a href="com/default.asp"
>组件</a> - <a href="chat/default.asp"
>谈天</a> - <a href="bbs1/default.asp"
>论坛</a> - <a href="aspbook.asp"
>教程</a> - <a href="www.asp"
>站点</a> - <a href="aspgbook/addguest.htm"
>留言</a> - <a href="products.htm"
>产品销售</a> - </font><a href="freehost.asp"
style="color: rgb(255,255,0)"><font color="#00FF80">免费空间</font></a><font
color="#FFFFFF"><img src=http://www.jiafangren.com/uploads/allimg/201011/0AS54Z5-2.gif" width="30" height="14" alt=http://www.jiafangren.com/uploads/allimg/201011/0AS54Z5-2.gif (1181 bytes)"></font></td>
</tr>
</table>
<table border="1" width="100%" bordercolor="#808080" bordercolorlight="#FFFFFF"
bordercolordark="#C0C0C0" >
<tr>
<td width="19%" valign="top"><table border="1" width="100%" bordercolor="#008080"
bordercolorlight="#000000" bordercolordark="#FFFFFF" bgcolor="#C0C0C0" cellspacing="0" cellpadding="0">
<tr>