ASP爱好者网站首页(ASP+版本)代码
作者:刘玉锋http://aspfans.yeah.net
前一段时间本站将首页更换为了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")
补充:asp教程,高级应用