分享
 
 
 

SQLServer服务器访问ADO

王朝mssql·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

平常我们只听说过ADO等一类ASP对象,但在ASP中还有个鲜为人知的专门SQL Server的ASP访问对象,它就是SQLOLE.SQLServer对象。SQLOLE.SQLServer可以直接访问SQL Server的系统属性。以Set oSQLServer = CreateObject ("SQLOLE.SQLServer")语句将产生一个SQL Server服务器对象。

若要查看此服务器中数据库的集合,可用语句:

For Each SQLDB In oSQLServer.Databases

Response.Write SQLDB.Name ‘将列出所有的数据库,如Pubs等

Next

若要查看某数据库中(如PUBS数据库)数据表的集合,可用语句:

pubDatabase=oSQLServer.Databases(“pubs”)

’oSQLServer是前面创建的SQL Server服务器对象

For Each DBTable In pubDatabase.Tables

Response.Write DBTable.Name

Next

下面的语句将列出数据库中(PUBS数据库)数据视图

pubDatabase =oSQLServer.Databases(“pubs”)

’oSQLServer是前面创建的SQL Server服务器对象

For Each DBView In pubDatabase.Views

Response.Write DBView.Text

Next

以下语句将列出数据库中(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

平常我们只听说过ADO等一类ASP对象,但在ASP中还有个鲜为人知的专门SQL Server的ASP访问对象,它就是SQLOLE.SQLServer对象。SQLOLE.SQLServer可以直接访问SQL Server的系统属性。以Set oSQLServer = CreateObject ("SQLOLE.SQLServer")语句将产生一个SQL Server服务器对象。

若要查看此服务器中数据库的集合,可用语句:

For Each SQLDB In oSQLServer.Databases

Response.Write SQLDB.Name ‘将列出所有的数据库,如Pubs等

Next

若要查看某数据库中(如PUBS数据库)数据表的集合,可用语句:

pubDatabase=oSQLServer.Databases(“pubs”)

’oSQLServer是前面创建的SQL Server服务器对象

For Each DBTable In pubDatabase.Tables

Response.Write DBTable.Name

Next

下面的语句将列出数据库中(PUBS数据库)数据视图

pubDatabase =oSQLServer.Databases(“pubs”)

’oSQLServer是前面创建的SQL Server服务器对象

For Each DBView In pubDatabase.Views

Response.Write DBView.Text

Next

以下语句将列出数据库中(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

列出 IE5 所支持的所有server端变量

以下是MSDN (1999年4月版)提供的 IE5 所支持的所有server端变量

部分变量在以前的版本中不支持,而且在以后的版本中可能会有变化(这是Microsoft的原话)

Variable Description

ALL_HTTP All HTTP headers sent by the client.

ALL_RAW Retrieves all headers in the raw-form. The difference between ALL_RAW and ALL_HTTP is that ALL_HTTP places an HTTP_ prefix before the header name and the header-name is always capitalized. In ALL_RAW the header name and values appear as they are sent by the client.

APPL_MD_PATH Retrieves the metabase path for the (WAM) Application for the ISAPI DLL.

APPL_PHYSICAL_PATH Retrieves the physical path corresponding to the metabase path. IIS converts the APPL_MD_PATH to the physical (directory) path to return this value.

AUTH_PASSWORD The value entered in the client's authentication dialog. This variable is only available if Basic authentication is used.

AUTH_TYPE The authentication method that the server uses to validate users when they attempt to access a protected script.

AUTH_USER Raw authenticated user name.

CERT_COOKIE Unique ID for client certificate, Returned as a string. Can be used as a signature for the whole client certificate.

CERT_FLAGS bit0 is set to 1 if the client certificate is present.

bit1 is set to 1 if the Certificate Authority of the client certificate is invalid (not in the list of recognized CA on the server).

CERT_ISSUER Issuer field of the client certificate (O=MS, OU=IAS, CN=user name, C=USA).

CERT_KEYSIZE Number of bits in Secure Sockets Layer connection key size. For example, 128.

CERT_SECRETKEYSIZE Number of bits in server certificate private key. For example, e.g. 1024.

CERT_SERIALNUMBER Serial number field of the client certificate.

CERT_SERVER_ISSUER Issuer field of the server certificate.

CERT_SERVER_SUBJECT Subject field of the server certificate.

CERT_SUBJECT Subject field of the client certificate.

CONTENT_LENGTH The length of the content as given by the client.

CONTENT_TYPE The data type of the content. Used with queries that have attached information, such as the HTTP queries GET, POST, and PUT.

GATEWAY_INTERFACE The revision of the CGI specification used by the server. The format is CGI/revision.

HTTP_<HeaderName The value stored in the header HeaderName. Any header other than those listed in this table must be prefixed by HTTP_ in order for the ServerVariables collection to retrieve its value.

Note The server interprets any underscore (_) characters in HeaderName as dashes in the actual header. For example if you specify HTTP_MY_HEADER, the server searches for a header sent as MY-HEADER.

HTTP_ACCEPT Returns the value of the Accept header.

HTTP_ACCEPT_LANGUAGE Returns a string describing the language to use for displaying content.

HTTP_USER_AGENT Returns a string describing the browser that sent the

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有