来源: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
%>
|