ASP教程 使用VB将ASP代码封装生成DLL文件
[ 日期:2008-03-07 04:24 PM ] [ 来自:本站原创 ]使用article.dll前的index.asp中的代码:
程序代码: | [ 复制代码 ] [ 运行代码 ] [ 另存代码 ] |
<% Set conn=Server.CreateObject("ADODB.Connection")
strcon = "Provider=
Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("Article.mdb")
conn.Open strcon %>
<% Set rs = Server.CreateObject ("ADODB.Recordset")
sql="select * from Article order by ArticleID desc"
rs.Open sql, Conn,1,1 %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>文章管理系统-CSSTUDIO</title>
</head>
<body bgcolor="#FFFFFF" topmargin="0">
<table width="100%" border="0" cellpadding="2"
cellspacing="0">
<tr>
<td width="742" height="20">文章标题</td>
<td width="90">点击</td>
<td width="145">添加日期</td>
</tr>
</table>
<% While Not Rs.Eof And Rows<Rs.PageSize %>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="747" height="20">☆<a href="view.asp?id=<%
= rs("ArticleID") %>">
<% =rs("标题") %></a></td>
<td width="94"><% = rs("点击") %></td>
<td width="148"><% = rs("添加日期") %></td>
</tr>
</table>
<% Rs.MoveNext
Wend %>
</body>
</html>
<% rs.close
set rs=nothing
conn.close
set conn=nothing %>
strcon = "Provider=

"Data Source=" & Server.MapPath("Article.mdb")
conn.Open strcon %>
<% Set rs = Server.CreateObject ("ADODB.Recordset")
sql="select * from Article order by ArticleID desc"
rs.Open sql, Conn,1,1 %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>文章管理系统-CSSTUDIO</title>
</head>
<body bgcolor="#FFFFFF" topmargin="0">
<table width="100%" border="0" cellpadding="2"
cellspacing="0">
<tr>
<td width="742" height="20">文章标题</td>
<td width="90">点击</td>
<td width="145">添加日期</td>
</tr>
</table>
<% While Not Rs.Eof And Rows<Rs.PageSize %>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="747" height="20">☆<a href="view.asp?id=<%
= rs("ArticleID") %>">
<% =rs("标题") %></a></td>
<td width="94"><% = rs("点击") %></td>
<td width="148"><% = rs("添加日期") %></td>
</tr>
</table>
<% Rs.MoveNext
Wend %>
</body>
</html>
<% rs.close
set rs=nothing
conn.close
set conn=nothing %>
四、结论
因为这些代码是在服务器端运行的,所以客户端不需要安装任何东西。这仅仅是用ActiveX DLL所能实现的功能的小小的例子。你们可以写好自己的更大的组件,而且还可以用VB中的很多控件。让我们用组件来扩展我们的程序的功能吧!也希望多多的看到我们中国人的组件。但愿本文能起到抛砖引玉的作用。
[本日志由 烈火 于 2008-03-08 10:49 AM 编辑]



本站声明:此文章或文件来源于网络,如果未属名,可能因为此文被转摘多次,原作者不详,如果您认为侵权,请联系我。我将在第一时间按要求做出处理,并消除影响。
暂时没有评论