用VB将ASP代码封装成DLL__教程 |
|
日期:2007-5-20 1:22:20 人气:77 [大 中 小] |
|
|
|
Response.Write "<table width=""100%"" border=""0"" cellpadding=""2"" cellspacing=""0"">" & vbCrLf Response.Write " <tr>" & vbCrLf Response.Write " <td width=""742"" height=""20"">文章标题</td>" & vbCrLf Response.Write " <td width=""90"">点击</td>" & vbCrLf Response.Write " <td width=""145"">添加日期</td>" & vbCrLf Response.Write " </tr>" & vbCrLf Response.Write "</table>" & vbCrLf While Not rs.EOF And Rows < rs.PageSize Response.Write "<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""0"">" & vbCrLf Response.Write " <tr>" & vbCrLf Response.Write " <td width=""747"" height=""20"">☆<a href=""view.asp?id=" Response.Write rs("ArticleID") Response.Write """>" & vbCrLf Response.Write " " Response.Write rs("标题") Response.Write "</a></td>" & vbCrLf Response.Write " <td width=""94"">" Response.Write rs("点击") Response.Write "</td>" & vbCrLf Response.Write " <td width=""148"">" Response.Write rs("添加日期") Response.Write "</td>" & vbCrLf Response.Write " </tr>" & vbCrLf Response.Write "</table>" & vbCrLf rs.MoveNext Wend Response.Write "</body>" & vbCrLf Response.Write "</html>" & vbCrLf rs.Close Set rs = Nothing conn.Close Set conn = Nothing Exit Sub Err: If Err.Number = -13572468 Then Exit Sub Resume Next End Sub 使用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> |
|
出处:本站原创 作者:佚名 |
|
|