---- 以下語句將列出數據庫中(PUBS數據庫)存貯過程
pubDatabase =oSQLServer.Databases(“pubs”) ’oSQLServer是前面創建的SQL Server服務器對象 For Each DBSP In pubDatabase.StoredProcedures Response.Write DBSP.Text Next
---- 程序運行的結果(取數據表名):
---- 取存貯過程的結果:
---- 一個完整的小例子源碼附后(其它功能讀者可加入)。
< %@ LANGUAGE = VBScript % >
< HTML > < HEAD > < META NAME="GENERATOR" Content= "Microsoft Developer Studio" > < META HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312" >
< TITLE >< /TITLE > < /HEAD >
< % On Error Resume Next Dim oSQLServer Set oSQLServer = CreateObject ("SQLOLE.SQLServer")
strServer = "dep" strLogin = "sa" strPwd = ""
oSQLServer.Connect strServer,strLogin,strPwd
% >
< BODY BGCOLOR=#ffffff > 數據庫列表 < SELECT NAME="Database" > < % For Each SQLDB In oSQLServer.Databases If Not SQLDB.SystemObject Then Response.Write "< OPTION VALUE= """ & SQLDB.Name & """ >" & SQLDB.Name
& " " End If Next Set oSQLServer = Nothing % > < /SELECT > < /BODY > < /HTML >
|