电脑爱好者,提供IT资讯信息及各类编程知识文章介绍,欢迎大家来本站学习电脑知识。 最近更新 | 联系我们 RSS订阅本站最新文章
电脑爱好者
站内搜索: 
当前位置:首页>> Asp>>VB开发ASP组件经典事例[三]:

VB开发ASP组件经典事例[三]

来源:www.cncfan.com | 2006-11-3 | (有2442人读过)

[三] ASP页中调用DLL

Operate.asp
-----------------------------------------------------------------------------------

<%

Dim StrConn,TestCOM

Dim action,cd_id,cd_name,cd_author



StrConn = "driver={sql server};server=(local);uid=sa;password=love!@#;database=Northwind"

Set TestCOM = Server.CreateObject("TestCOM.CDTB")

TestCOM.OpenDB(StrConn)



action = Request.QueryString("action")

cd_id = Request.QueryString("cd_id")

cd_name = Request.QueryString("cd_name")

cd_author = Request.QueryString("cd_author")



Response.Write("action:"&action&"<br>")

Response.Write("CD_ID:"&cd_id&"<br>")

Response.Write("CD_Name:"&cd_name&"<br>")

Response.Write("CD_Author:"&cd_author&"<p>")



Select Case action

Case "Add"

If TestCOM.Add(CStr(StrConn),Cstr(cd_name),CStr(cd_author)) Then

Response.Write("Add Success!")

Else

Response.Write("Add fail!")

End If

Case "Delete"

If TestCOM.Delete(CStr(StrConn),CStr(cd_id)) Then

Response.Write("Delete Success!")

Else

Response.Write("Delete Fail!")

End If

Case "Search"

Dim RS

set RS = TestCOM.Search(CStr(strconn),CStr(cd_id))

If not RS.eof Then

Response.Write("CD_Name:"& RS(1) &"<br>CD_Author:"& RS(2))

Else

Response.Write("No Any Records!")

End If

Case "Update"

If TestCOM.Update(CStr(StrConn),CStr(cd_id),CStr(cd_name),CStr(cd_author)) Then

Response.Write("Update Success!")

Else

Response.Write("Update Fail!")

End If

End Select

%>


Asp热门文章排行
网站赞助商
购买此位置

 

关于我们 | 网站地图 | 文档一览 | 友情链接| 联系我们

Copyright © 2003-2024 电脑爱好者 版权所有 备案号:鲁ICP备09059398号