|
技术资料 > ASP技术 > 系统相关 : ASP爱好者网站首页(ASP+版本)代码 |
ASP爱好者网站首页(ASP+版本)代码 March 25,2004 |
作者:刘玉锋
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")
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="image/aspfans.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="468x60-21ITT2.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="new9.gif" width="30" height="14" alt="new9.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>
<td width="100%" bgcolor="#C0C0C0"><p align="center"><font color="#FFFFFF"><<<a
href="http://asfans.yeah.net"
onClick="window.external.addFavorite('http://aspfans.yeah.net','ASP爱好者')"
class="p12">添加到收藏夹</a>>></font></td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0"><p align="center"><font color="#FFFFFF">当前在线:<%=application
("online")%>
人</font></td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0"><p align="center"><font color="#000000">本站产品</font></td>
</tr>
<tr>
<td width="100%" bgcolor="#EEEEEE"> <font color="#FF0000"><strong>免费ASP文章代码
</strong></font>,<a
href="freecode.asp">请点击此处</a>!<br>
<table>
<tr>
<td width="100%"><img alt="S-point.gif (204 bytes)" src="S-point.gif" width="18" height="14"><font
color="#0000ff"><a href="votedemo.asp" name="信息系统">通用网站投票调查系统</a>(</font><font
color="#ff0000">new</font><font color="#0000ff">)</font></td>
</tr>
<tr>
<td width="100%"><img alt="S-point.gif (204 bytes)" src="S-point.gif" width="18" height="14"><a
href="xinxi.asp" name="信息系统"><font color="#0000ff">通用网站信息发布管理系统(专业版)</font></a></td>
</tr>
<tr>
<td width="100%"><img alt="S-point.gif (204 bytes)" src="S-point.gif" width="18" height="14"><a
href="gongqiu.asp"><font color="#0000ff">通用网站供求系统(企业版)</font></a></td>
</tr>
<tr>
<td width="100%"><img alt="S-point.gif (204 bytes)" src="S-point.gif" width="18" height="14"><a
href="paimai.asp"><font color="#0000ff">通用拍卖网站系统(专业版)</font></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0"><p align="center"><font color="#000000">本站组件产品</font></td>
</tr>
<tr>
<td width="100%" bgcolor="#EEEEEE"><font color="#5878f8">■<a href="lyfdns.htm"
target="_blank">LyfDns1.0</a>(</font><font
color="#FF0080">DNS组件</font><font color="#5878f8">)<br>
■<a href="lyfimage.htm" target="_blank">LyfImage</a>1.0(</font><font color="#FF0080">图形组件</font><font
color="#5878f8">)<br>
■<a href="lyfupload.htm" target="_blank">LyfUpload</a>1.2(</font><font color="#FF0080">文件上传组件
</font><font
color="#5878f8">)<br>
■<a href="lyfmail.htm" target="_blank">LyfEmail</a>(</font><font color="#FF0080">Email组件</font><font
color="#5878f8">)</font></td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0"><font color="#FFFFFF"><p align="left">
欢迎加入本站的邮件列表以便获得本站的更新信息及本站产品信息!</font></td>
</tr>
<tr>
<td width="100%"><form method="post"
action="http://maillist2.bodachina.com//cgi/mlist.fcgi?FN=1">
<input type="hidden" name="MLID" value="37589"><p>请输入您的email地址:<input
type="text" name="EMAIL" size="20"><br>
<input type="submit" name="SUB" value="订阅"> <input type="submit" name="UNSUB"
value="取消"> </p>
</form>
</td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0"><p align="center"><font color="#000000">站长的其它网站</font><font
color="#FFFFFF"><script
language="javascript">
function winopen(url)
{
if(url!="#")
window.open
(url,"search","toolbar=0,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=780,hei
ght=450,top=0,left=0");
}
</script></font></td>
</tr>
<tr>
<td width="100%" bgcolor="#EEEEEE"><a style="color: rgb(0,0,255)" href="http://jspbbs.yeah.net"
target="_blank">JSP爱好者</a><font
color="#FFFFFF"><img src="new9.gif" width="30" height="14" alt="new9.gif (1181 bytes)"></font><a
style="color: rgb(0,0,255)" href="http://jspbbs.yeah.net" target="_blank"><br>
华中拍卖网</a><br>
<a href="http://macroweb.my168.net" target="_blank" style="color: rgb(0,0,255)">图书在线</a><br>
<a href="http://vbfans.yeah.net" target="_blank" style="color: rgb(0,0,255)">VB爱好者</a></td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0"><p align="center"><font color="#000000">首页友情链接</font></td>
</tr>
<tr>
<td width="100%" bgcolor="#EEEEEE"><a href="http://aasp.yeah.net" target="_blank"
style="color: rgb(0,0,255)">ASP动网先锋</a></td>
</tr>
<tr>
<td width="100%" bgcolor="#EEEEEE"><a href="http://aspnet.on.net.cn" target="_blank">ASP下载特区</a></td>
</tr>
<tr>
<td width="100%" bgcolor="#EEEEEE"><a href="http://asphelper.yeah.net" target="_blank">ASP空间站</a></td>
</tr>
<tr>
<td width="100%" bgcolor="#EEEEEE"><a href="http://asp3.126.com/" target="_blank">ASP三角洲</a></td>
</tr>
<tr>
<td width="100%" bgcolor="#EEEEEE"><a href="http://aspage.yeah.net" target="_blank">ASP精品屋</a></td>
</tr>
<tr>
<td width="100%" bgcolor="#EEEEEE"><a href="http://www.tv2nd.com/" target="_blank">第二频道</a></td>
</tr>
</table>
</td>
<td width="81%" valign="top" bgcolor="#F2F2F2"><table border="1" width="100%"
bordercolor="#008080" bordercolordark="#FFFFFF"
bgcolor="#F2F2F2" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" bgcolor="#C0C0C0" height="20"><strong><font color="#00FF00">→</font><font
color="#000000">本站新闻</font></strong> </td>
</tr>
<tr>
<td width="100%" height="20"><font color="#FFFFFF"> </font><img
src="image/l-7.gif" width="26" height="20" alt="l-7.gif (371 bytes)"><font color="#008080">不少朋友反映首页
速度慢,为了能使大家访问本站的速度更快,站长特意将首页程序重新写成了</font><font color="#FF0000"><b>ASP+程
序</b></font><font color="#008080">,编译后相信能满足大家的要求了,看看速度是不是更快点。</font><br>
<font color="#FF0000"><strong>HOT,本站程序继续热卖中,纯手工制作,工艺精
美,价格公道,童叟无欺,欢迎大家联系购买!:)程序优惠销售即将结束,感谢大家支持。<br>
</strong></font> <font color="#000000">为答谢各位ASP爱好者对本站的支持,ASP爱好者网站率先
推出网站程序的百日风暴销售活动,如果您是本站邮件列表的用户,在此其间(7.18-10.28)凭您的邮件地址购买本站产品
均可以享受到特别优惠的价格,</font><b><font color="#FF0000">部分低到180元/套的价格</font></b><font
color="#000000">,心动不如行动!</font></td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0" height="20"><font color="#FFFF80"><strong>→</strong></font><font
color="#000000"><b>技术文章</b></font></td>
</tr>
<tr>
<td width="100%">
<%dim surl as String%>
<asp:DataList id="dlwenzhang" width="100%" runat="server">
<template name = "ItemTemplate">
<a href=forum/count.asp?save=<%# Container.DataItem("Topic_ID") %>&url=topic.asp?topic_id=<%#
Container.DataItem("Topic_ID") %>>
·=><%# Container.DataItem("T_subject") %></a> </font>
<font color='#FF8000'><strong>[<%# Container.DataItem("F_name") %>]</strong></font>
<%# Container.DataItem("T_Last_Post") %> <br>
<%# left(Container.DataItem("T_message"),50) %>...<br>
</template>
</asp:DataList>
<p align="right"><a href="forum/default.asp">>>更多文章</a></td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0" height="20"><font color="#00FFFF"><strong>→</strong></font><font
color="#000000"><b>源码天地</b></font></td>
</tr>
<tr>
<td width="100%">
<asp:DataList id="daima" width="100%" runat="server">
<template name = "ItemTemplate">
<a href=source/redirect.asp?linkid=<%# Container.DataItem("linkid") %>>
·=><%# Container.DataItem("linkname") %></a> </font>
(<font color=red><%# Container.DataItem("good") %></font>)
<%# Container.DataItem("linkadded") %><br>
<%# left(Container.DataItem("linkdesc"),50) %>...<br>
</template>
</asp:DataList>
<p align="right"><a href="source/default.asp">>>更多源码</a></td>
</tr>
<tr>
<td width="100%" bgcolor="#C0C0C0" height="20"><font color="#00FFFF"><strong>→</strong></font><font
color="#000000"><b>组件天地</b></font></td>
</tr>
<tr>
<td width="100%">
<asp:DataList id="zujian" width="100%" runat="server">
<template name = "ItemTemplate">
<a href=source/redirect.asp?linkid=<%# Container.DataItem("linkid") %>>
·=><%# Container.DataItem("linkname") %></a> </font>
(<font color=red><%# Container.DataItem("good") %></font>)
<%# Container.DataItem("linkadded") %><br>
<%# left(Container.DataItem("linkdesc"),50) %>...<br>
</template>
</asp:DataList>
<p align="right"><a href="source/default.asp">>>更多组件</a></td>
</tr>
</table>
</td>
</tr>
</table>
<table border="1" width="100%" bordercolor="#008080" bordercolordark="#FFFFFF"
bordercolorlight="#000000" bgColor="#eeeeee" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" ><p align="center">CopyRight By <a
href="mailto:[email protected]">ASP爱好者</a><br>
本页面建议在800*600分辨率、IE4.0以上浏览器浏览 <br>
本站点由 <a href="mailto:[email protected]">刘玉锋</a> 制作维护
<span style="background-color: #FFFFFF">中国 广州</span> </td>
</tr>
<tr>
<td width="100%"><p align="center">自2000年4月4日<br>
<script>
document.write("<a href=http://webpub.au.tsinghua.edu.cn/count/count.dll?Type=Basic&id=8250&ReferID=8250
target=_blank>");
document.write("<img src=http://webpub.au.tsinghua.edu.cn/count/count.dll?
Type=Img5&add=1&id=8250&refer="+escape(top.document.referrer)+" border=0 alt=酷站今日访问>");
document.write("</a>");
</script> </td>
</tr>
</table>
</body>
</html>
|
|