📄 sql server访问ado.htm
字号:
href="http://lzjx.com/w/main.asp?id=523&sx=jc">ASP的技术特点与使用方法</A><BR>·<A
href="http://lzjx.com/w/main.asp?id=522&sx=jc">SQL
Server访问ADO</A><BR>·<A
href="http://lzjx.com/w/main.asp?id=521&sx=jc">ASP个人上手指南</A><BR></TD></TR></TBODY></TABLE><SPAN
class=l15></SPAN></TD>
<TD vAlign=top align=middle width=1 bgColor=#cccccc></TD>
<TD vAlign=top align=middle width=592 bgColor=#ffffff>
<TABLE cellSpacing=0 cellPadding=6 width="98%" border=0>
<TBODY>
<TR>
<TD class=xx vAlign=bottom height=30>■ 基础教程 > SQL
Server访问ADO</TD></TR></TBODY></TABLE>
<TABLE height=119 cellSpacing=6 cellPadding=3 width="99%" border=0>
<TBODY>
<TR>
<TD class=xk vAlign=top align=left width="50%">----
平常我们只听说过ADO等一类ASP对象,但在ASP中还有个鲜为人知的专门SQL
Server的ASP访问对象,它就是SQLOLE.SQLServer对象。SQLOLE.SQLServer可以直接访问SQL
Server的系统属性。以Set oSQLServer = CreateObject
("SQLOLE.SQLServer")语句将产生一个SQL Server服务器对象。 <BR><BR>----
若要查看此服务器中数据库的集合,可用语句: <BR><BR>For Each SQLDB In
oSQLServer.Databases<BR>Response.Write SQLDB.Name
‘将列出所有的数据库,如Pubs等<BR>Next<BR><BR>----
若要查看某数据库中(如PUBS数据库)数据表的集合,可用语句:
<BR><BR>pubDatabase=oSQLServer.Databases(“pubs”)<BR>’oSQLServer是前面创建的SQL
Server服务器对象<BR>For Each DBTable In
pubDatabase.Tables<BR>Response.Write
DBTable.Name<BR>Next<BR><BR>---- 下面的语句将列出数据库中(PUBS数据库)数据视图
<BR><BR>pubDatabase
=oSQLServer.Databases(“pubs”)<BR>’oSQLServer是前面创建的SQL
Server服务器对象<BR>For Each DBView In
pubDatabase.Views<BR>Response.Write DBView.Text<BR>Next<BR><BR>----
以下语句将列出数据库中(PUBS数据库)存贮过程 <BR><BR>pubDatabase
=oSQLServer.Databases(“pubs”)<BR>’oSQLServer是前面创建的SQL
Server服务器对象<BR>For Each DBSP In
pubDatabase.StoredProcedures<BR>Response.Write
DBSP.Text<BR>Next<BR><BR>---- 程序运行的结果(取数据表名): <BR><BR>---- 取存贮过程的结果:
<BR><BR>---- 一个完整的小例子源码附后(其它功能读者可加入)。 <BR><BR>< %@ LANGUAGE =
VBScript % ><BR><BR>< HTML ><BR>< HEAD ><BR>< META
NAME="GENERATOR" Content=<BR>"Microsoft Developer Studio"
><BR>< META HTTP-EQUIV="Content-Type"<BR>content="text/html;
charset=gb2312" ><BR><BR>< TITLE >< /TITLE ><BR><
/HEAD ><BR><BR>< %<BR>On Error Resume Next<BR>Dim
oSQLServer<BR>Set oSQLServer = CreateObject
("SQLOLE.SQLServer")<BR><BR><BR>strServer = "dep"<BR>strLogin =
"sa"<BR>strPwd = ""<BR><BR><BR>oSQLServer.Connect
strServer,strLogin,strPwd<BR><BR><BR>% ><BR><BR><BR>< BODY
BGCOLOR=#ffffff ><BR>数据库列表<BR>< SELECT NAME="Database"
><BR>< %<BR>For Each SQLDB In oSQLServer.Databases<BR>If Not
SQLDB.SystemObject Then<BR>Response.Write "< OPTION VALUE=<BR>"""
& SQLDB.Name & """ >" & SQLDB.Name <BR><BR>& "
"<BR>End If<BR>Next<BR>Set oSQLServer = Nothing<BR>% ><BR><
/SELECT ><BR>< /BODY ><BR>< /HTML ><BR><BR><BR>列出 IE5
所支持的所有server端变量<BR><BR><BR><BR>以下是MSDN (1999年4月版)提供的 IE5
所支持的所有server端变量<BR>部分变量在以前的版本中不支持,而且在以后的版本中可能会有变化(这是Microsoft的原话)<BR><BR>Variable
Description <BR>ALL_HTTP All HTTP headers sent by the client.
<BR>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. <BR>APPL_MD_PATH Retrieves the metabase path for the (WAM)
Application for the ISAPI DLL. <BR>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.
<BR>AUTH_PASSWORD The value entered in the client's authentication
dialog. This variable is only available if Basic authentication is
used. <BR>AUTH_TYPE The authentication method that the server uses
to validate users when they attempt to access a protected script.
<BR>AUTH_USER Raw authenticated user name. <BR>CERT_COOKIE Unique ID
for client certificate, Returned as a string. Can be used as a
signature for the whole client certificate. <BR>CERT_FLAGS bit0 is
set to 1 if the client certificate is present. <BR>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).<BR><BR>CERT_ISSUER
Issuer field of the client certificate (O=MS, OU=IAS, CN=user name,
C=USA). <BR>CERT_KEYSIZE Number of bits in Secure Sockets Layer
connection key size. For example, 128. <BR>CERT_SECRETKEYSIZE Number
of bits in server certificate private key. For example, e.g. 1024.
<BR>CERT_SERIALNUMBER Serial number field of the client certificate.
<BR>CERT_SERVER_ISSUER Issuer field of the server certificate.
<BR>CERT_SERVER_SUBJECT Subject field of the server certificate.
<BR>CERT_SUBJECT Subject field of the client certificate.
<BR>CONTENT_LENGTH The length of the content as given by the client.
<BR>CONTENT_TYPE The data type of the content. Used with queries
that have attached information, such as the HTTP queries GET, POST,
and PUT. <BR>GATEWAY_INTERFACE The revision of the CGI specification
used by the server. The format is CGI/revision.
<BR>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. <BR>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. <BR><BR>HTTP_ACCEPT Returns the value of
the Accept header. <BR>HTTP_ACCEPT_LANGUAGE Returns a string
describing the language to use for displaying content.
<BR>HTTP_USER_AGENT Returns a string describing the browser that
sent the request. <BR>HTTP_COOKIE Returns the cookie string that was
included with the request. <BR>HTTP_REFERER Returns a string
containing the URL of the original request when a redirect has
occurred. <BR>HTTPS Returns ON if the request came in through secure
channel (SSL) or it returns OFF if the request is for a non-secure
channel. <BR>HTTPS_KEYSIZE Number of bits in Secure Sockets Layer
connection key size. For example, 128. <BR>HTTPS_SECRETKEYSIZE
Number of bits in server certificate private key. For example, 1024.
<BR>HTTPS_SERVER_ISSUER Issuer field of the server certificate.
<BR>HTTPS_SERVER_SUBJECT Subject field of the server certificate.
<BR>INSTANCE_ID The ID for the IIS instance in textual format. If
the instance ID is 1, it appears as a string. You can use this
variable to retrieve the ID of the Web-server instance (in the
metabase) to which the request belongs. <BR>INSTANCE_META_PATH The
metabase path for the instance of IIS that responds to the request.
<BR>LOCAL_ADDR Returns the Server Address on which the request came
in. This is important on multihomed machines where there can be
multiple IP addresses bound to a machine and you want to find out
which address the request used. <BR>LOGON_USER The Windows NT®
account that the user is logged into. <BR>PATH_INFO Extra path
information as given by the client. You can access scripts by using
their virtual path and the PATH_INFO server variable. If this
information comes from a URL, it is decoded by the server before it
is passed to the CGI script. <BR>PATH_TRANSLATED A translated
version of PATH_INFO that takes the path and performs any necessary
virtual-to-physical mapping. <BR>QUERY_STRING Query information
stored in the string following the question mark (?) in the HTTP
request. <BR>REMOTE_ADDR The IP address of the remote host making
the request. <BR>REMOTE_HOST The name of the host making the
request. If the server does not have this information, it will set
REMOTE_ADDR and leave this empty. <BR>REMOTE_USER Unmapped user-name
string sent in by the User. This is the name that is really sent by
the user as opposed to the ones that are modified by any
authentication filter installed on the server. <BR>REQUEST_METHOD
The method used to make the request. For HTTP, this is GET, HEAD,
POST, and so on. <BR>SCRIPT_NAME A virtual path to the script being
executed. This is used for self-referencing URLs. <BR>SERVER_NAME
The server's host name, DNS alias, or IP address as it would appear
in self-referencing URLs. <BR>SERVER_PORT The port number to which
the request was sent. <BR>SERVER_PORT_SECURE A string that contains
either 0 or 1. If the request is being handled on the secure port,
then this will be 1. Otherwise, it will be 0. <BR>SERVER_PROTOCOL
The name and revision of the request information protocol. The
format is protocol/revision. <BR>SERVER_SOFTWARE The name and
version of the server software that answers the request and runs the
gateway. The format is name/version. <BR>URL Gives the base portion
of the URL. </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="98%" border=0>
<TBODY>
<TR>
<TD>■今日推荐:<A
href="http://lzjx.com/w/main.asp?id=388&sx=jc">ASP内建对象Serv</A>
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=800 bgColor=#ffffff border=0>
<TBODY>
<TR>
<TD background="SQL Server访问ADO.files/qw39.gif"></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=1 cellPadding=5 width=800 bgColor=#ffffff border=0>
<TBODY>
<TR>
<TD class=N noWrap align=middle>
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgColor=#ffffff
border=0><TBODY>
<TR>
<TD
background="SQL Server访问ADO.files/qw39.gif"></TD></TR></TBODY></TABLE><BR>本网站是学习网站,内容整理大多来自互联网,尽量标明了出处,如果侵犯了您的权力请通知我,立即纠正<BR>欢迎提出宝贵建议,提供相关资料,以便相互学习,共同提高!<BR>
<OBJECT
codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0
height=18 width=103 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="BGCOLOR" VALUE=""><PARAM NAME="movie" VALUE="../images/21sg.swf"><PARAM NAME="quality" VALUE="high">
<embed src="../images/21sg.swf"
quality="high"
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash" width="103" height="18" ></embed>
</OBJECT></TD></TR>
<TR>
<TD height=79> </TD></TR>
<TR>
<TD align=middle></TD></TR></TBODY></TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -