关闭

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

1272人阅读 评论(0) 收藏 举报

 

[] 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

%>

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:194659次
    • 积分:2506
    • 等级:
    • 排名:第15621名
    • 原创:46篇
    • 转载:32篇
    • 译文:0篇
    • 评论:38条