Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
Open Method
Connection Object
PROPERTY: Connection::ConnectionString
string =
connectionobject.
ConnectionString
connectionobject.
ConnectionString
= string
Carl Prothman of Able Consulting, Inc. maintains a web site containing sample ADO connection strings for ODBC DSN, ODBC DSN-Less, OLE DB Provider, and MS Remote. The Guru highly recommends you visit this extremely useful site.
The
ConnectionString
property can be used to set or return a string that contains the information needed to establish a connection to a data source. The string is typically composed of a series of parameter=value statements that are separated by semicolons. After you complete the connection, the provider may alter these ADO parameter=value statements to the provider equivalents.
Note that the
ConnectionString
string is also passed as part of the
Open
method call of the
Connection
object. The values of
ConnectionString
parameter of the method call are automatically inherited by the
ConnectionString
property. Therefore, these values are set by the
Open
method. (Also, the
Open
method allows the optional use of a user ID and password.)
ADO supports five arguments for the connection string:
File Name=
is the name of a file that contains the connection information. If you use this parameter, you cannot use the
Provider=
parameter.
Provider=
is the name of the provider. If you use this parameter, you cannot use the
File Name=
parameter.
Remote Provider=
is the name of the provider that you use when you open a client-side connection. (for Remote Data Service)
Remote Server=
is the path name to the server that you use when you open a client-side connection. (for Remote Data Service)
URL=
is the absolute URL address to use for the connection.
Note: Duplicate parameters are ignored and only the last occurrence of a repeated parameter is used.
Here are some sample OLE DB
ConnectionString
examples:
OLE DB Provider for Active Directory Service:
"Provider=ADSDSOObject
;
"
OLE DB Provider for Index Server:
"Provider=MSIDXS
;
"
OLE DB Provider for Internet Publishing:
"Provider=MSDAIPP.DSO
;
Data Source=http://www.devguru.com/guru_dir"
OLE DB Provider for Microsoft Jet:
"Provider=Microsoft.Jet.OLEDB.4.0
;
Data Source=GuruData.mdb
;
"
OLE DB Provider for ODBC Databases:
"Provider=MSDASQL
;
Driver={SQL Server}
;
Server=GuruServer
;
DataBase=GuruDatabase
;
"
OLE DB Provider for Oracle:
"Provider=MSDAORA
;
Data Source=GuruTable
;
"
OLE DB Provider for SQL Server:
"Provider=SQLOLEDB
;
Data Source=GuruServer
;
Network Library=DBMSSOCN
;
Initial Catalog=GuruPubs
;
"
Code (VBScript):
Dim objConnection
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.
ConnectionString
=
"Provider=Microsoft.Jet.OLEDB.4.0
;
Data Source=GuruData.mdb
;
objConnection.ConnectionTimeout = 0
objConnection.Open
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information