当前位置: 主页 > 编程知识 > asp编程 > 将ASP代码用VB封装生成DLL文件

将ASP代码用VB封装生成DLL文件

时间:2010-2-10来源:站长资讯网 点击:

  使用article.dll后的index.asp中的代码:

以下是引用片段:
<%Dim AspTransBuilderObject

Set AspTransBuilderObject = Server.CreateObject("article.Class1")

AspTransBuilderObject.AspClassInit

Set AspTransBuilderObject = Nothing

使用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 %>

 

  四、结论

  因为这些代码是在服务器端运行的,所以客户端不需要安装任何东西。这仅仅是用ActiveX DLL所能实现的功能的小小的例子。你们可以写好自己的更大的组件,而且还可以用VB中的很多控件。让我们用组件来扩展我们的程序的功能吧!也希望多多的看到我们中国人的组件。但愿本文能起到抛砖引玉的作用。


站长资讯网
.
分页: [1] [2] [3]
TAG: ASP DLL文件
推荐内容最近更新人气排行
关于我们 | 友情链接 | 网址推荐 | 常用资讯 | 网站地图 | RSS | 留言