当前位置: 首页 > 图文教程 > 网络编程 > ASP > 手把手教你使用VB来创建ASP组件(7)

ASP
用asp执行DTC
利用ADODB.Stream使用浏览器下载服务器文件
应用数据库的唯一性约束并在asp中捕捉数据库的错误
用ASP编程控制在IIS建立Web站点
asp实现k线图(在线)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(7)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(6)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(5)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(4)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(3)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(2)
在ASP中用EasyMailObject组件处理Exchange邮件源代码(1)
用文本+ASP打造新闻发布系统。几点补充
用文本+ASP打造新闻发布系统(五)新闻修改
用文本+ASP打造新闻发布系统(四)新闻删除
用文本+ASP打造新闻发布系统(三)新闻列表显示
用文本+ASP打造新闻发布系统(二)新闻添加
ASP作的剪包锤游戏
ASP注册表项目修改
构建稳定的服务器端组件的七个步骤

手把手教你使用VB来创建ASP组件(7)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 59 ::
收藏到网摘: n/a

  (2)DeleteCdInformation.asp程序

  点击每条信息后的删除键就会从表中把该条信息删除,它也调用了我们刚刚注册的组件。限于篇幅,我只把最重要的几行代码写出:

〈%

Dim CD_Info

Set CD_Info =Server.CreateObject(“CD.CD_Handle”)

CD_Info.Delete Request.QueryString(“ID”)

%〉

(3)AddCDInformation.html

  本程序是一个纯HTML文本,只出现一个表单,让你填写新的CD信息,然后再发给InsertintoDB.asp来加入数据库。

〈html〉

〈head〉

〈meta http-equiv="Content-Language" content="zh-cn"〉

〈meta http-equiv="Content-Type" content="text/html; charset=gb2312"〉

〈title〉请您添加一条CD信息〈/title〉

〈/head〉

〈body〉

〈form method="POST" action="InsertintoDB.asp"〉

〈p〉 〈/p〉

〈p〉  请您添加一条CD信息〈/p〉

〈table border="1" cellspacing="1" width="34%" height="109"〉

〈tr〉

〈td width="24%" height="16"〉

〈p align="center"〉CD号〈/td〉

〈td width="76%" height="16"〉〈input type="text" name="ID" size="24"〉〈/td〉

〈/tr〉

〈tr〉

〈td width="24%" height="16"〉

〈p align="center"〉CD名〈/td〉

〈td width="76%" height="16"〉〈input type="text" name="Name" size="24"〉〈/td〉

〈/tr〉

〈tr〉

〈td width="24%" height="16"〉

〈p align="center"〉作者〈/td〉

〈td width="76%" height="16"〉〈input type="text" name="Author" size="24"〉〈/td〉

〈/tr〉

〈tr〉

〈td width="24%" height="16"〉

〈p align="center"〉价格〈/td〉

〈td width="76%" height="16"〉〈input type="text" name="Price" size="24"〉〈/td〉

〈/tr〉

〈tr〉

〈td width="24%" height="95"〉

〈p align="center"〉简介〈/p〉

〈p〉 〈/td〉

〈td width="76%" height="95" valign="top"〉〈textarea rows="4" name="Information" cols="22"〉〈/textarea〉〈/td〉

〈/tr〉

〈tr〉

〈td width="100%" height="15" colspan="2"〉

〈p align="center"〉〈input type="submit" value="提交" name="B1"〉〈input type="reset" value="取消" name="B2"〉〈/td〉

〈/tr〉

〈/table〉

〈/form〉

〈p〉   〈/p〉

〈/body〉

〈/html〉

(4)InsertIntoDB.asp程序,用到了组件中Add方法

〈HTML〉

〈HEAD〉

〈TITLE〉〈/TITLE〉

〈/HEAD〉

〈BODY〉

〈%DIM Insert_CD

set Insert_CD =Server.CreateObject("CD.CD_Handle")

Insert_CD.Add request.form("ID"),request.form ("Name"),request.form("Author"),request.form("Price"),request.form("Information")

%〉

〈p〉您已成功的加入一条书目〈/p〉

〈form name="A" Method="POST" Action="ListCdInformation.asp"〉

〈input type="SUBMIT" Value="返回" name="B1"〉

〈/form〉

〈/body〉

〈/html〉

六、总结

  上面我简要的介绍了组件的定义以及使用VB来编写ASP中组件的方法,其实上面所举的例子只是很粗浅的例子,相信大家写出的程序一定会比我的更好,我想如果有机会的话,我还会谢谢如何使用VC++和Java来编写COM组件,因为我觉得,如果你没有掌握COM组件,你也就没有掌握ASP的精髓。