1 / 10

ASP 个人博客建设与实现概述

ASP 个人博客建设与实现概述. 10 本计 3101092072_ 赵玲玲. 博客系统. 系统管理员. 相册浏览. 用户登录. 新用户注册. 博主资料. 日志发布. 用户留言. 日志浏览. 留言 浏览. 一、页面与数据库连接. 页面与数据库的连接,是实现一个动态网站数据存储与获取的重要环节,主要操作步骤如下: 1. 在 dreamweaver8 右侧 应用程序中选择数据库页签,如下图所示:. 2. 在 ODBC 数据源管理页面,选择“系统 DNS ”页签,从而创建数据源,如下图 所 示:.

Télécharger la présentation

ASP 个人博客建设与实现概述

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ASP个人博客建设与实现概述 10本计3101092072_赵玲玲

  2. 博客系统 系统管理员 相册浏览 用户登录 新用户注册 博主资料 日志发布 用户留言 日志浏览 留言浏览

  3. 一、页面与数据库连接 • 页面与数据库的连接,是实现一个动态网站数据存储与获取的重要环节,主要操作步骤如下: • 1.在dreamweaver8右侧应用程序中选择数据库页签,如下图所示:

  4. 2.在ODBC数据源管理页面,选择“系统DNS”页签,从而创建数据源,如下图所示:2.在ODBC数据源管理页面,选择“系统DNS”页签,从而创建数据源,如下图所示:

  5. 4.在安装页面填写名称,然后选择建立的数据库,如下图所示:4.在安装页面填写名称,然后选择建立的数据库,如下图所示:

  6. 5.这样就完成了数据库的连接,在右侧应用程序中选择数据库页签内,可以看到连接的数据库。5.这样就完成了数据库的连接,在右侧应用程序中选择数据库页签内,可以看到连接的数据库。 二、页面数据的存储与获取 • 论文中已详细介绍了如何利用dreamweaver8中自带的操作来实现功能的过程,这里主要讲解如何用代码实现。 • 1.如何用代码实现下图的记录集绑定功能。

  7. 通过此段代码可实现绑定记录集功能 <% Dim database //声明databaase变量 Dim database_numRows //声明database_numRows变量 Set database = Server.CreateObject("ADODB.Recordset")//新建记录集 database.ActiveConnection = MM_database_STRING//设置记录集的数据库连接字符串 database.Source = "SELECT * FROM 文本表"//设置记录集查询“文本表”中所有数据 database.CursorType = 0//设置记录集游标类型 database.CursorLocation = 2//设置游标所在位置 database.LockType = 1//设置读取该条记录时,其他记录锁定类型 database.Open()//打开记录集 database_numRows = 0//将0赋给database_numRows变量 %>

  8. 2.显现页面数据回显功能

  9. 通过以下代码实现回显功能: <% While ((Repeat1__numRows <> 0) AND (NOT database.EOF)) //当 Repeat1_numRows 的值不等于0,并且 database 的游标当前指向的不是最后一条记录,那么就执行 While 循环中的代码,否则跳出While 循环。 %> <table width="272" height="46" border="1" cellpadding="1" cellspacing="0" bordercolor="#666666"> <tr> <td width="39" nowrap="nowrap" bordercolor="#666666">标题:</td> <td width="223"bordercolor="#666666"><%=(database.Fields.Item("text_title").Value)%> </td> //粗体字解释:取出database表中字段名为“text_title”的字段的值 </tr> <tr> <td nowrap="nowrap" bordercolor="#666666">时间:</td> <td bordercolor="#666666"><%=(database.Fields.Item("text_time").Value)%></td> //粗体字解释:取出database表中字段名为“text_time”的字段的值 </tr> </table> <% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 database.MoveNext() Wend %>

  10. 谢谢!

More Related