ASP列出SQL数据库中(PUBS数据库)存储过程及其例子
类别: ASP教程
---- 以下语句将列出数据库中(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>
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>
- 上一篇: 取得浏览者的离开时间
- 下一篇: EVENT对象详解
-= 资 源 教 程 =-
文 章 搜 索