The Connection String
By far one of the most important properties of the Connection object would
have to be the Connection String! It specifies where to connect, who is
connectiong, what database to look at, etc. The connection string is the
backbone of the Connection object. Ole and SQL both use Connection Strings.
The connection string is formatted like this:
"keyword=value;keyword=value;keyword=value;keyword=value"
You get the idea.
Some Keywords:
SQL:
database - what database to look at
server - the server that you are connecting to
trusted_connection - whether or not the machine is trusted
(don't need uid/pw)
uid - username
pwd - password
OLE:
data source - Where the file is...
provider - the Data provider
Examples:
SQL: "server=tonydev;database=northwind;uid=tony;pwd=hrmmm"
"server=tonydev;database=northwind;trusted_connection=yes"
OLE: "Provider=Microsoft.Jet.OLEDB.4.0; Data source=C:\tony.mdb"
Both the SQL and OLE Connection object have a property called 'ConnectionString',
so the first thing you do after declaring the objects is set its connection
string.