ODBC Connection Strings
Standard Security:
<%
'declare the variable that will hold the connection string
Dim ConnectionString
'define connection string, specify database driver and location of the database
ConnectionString="Driver={SQLServer};Server=your_server_name;" &_
"Database=your_database_name;Uid=your_username;Pwd=your_password;"
%>
Trusted Connection:
<%
'declare the variable that will hold the connection string
Dim ConnectionString
'define connection string, specify database driver and location of the database
ConnectionString="Driver={SQLServer};Server=your_server_name;" &_
"Database=your_database_name;Trusted_Connection=yes;"
%>
OLE DB and OleDbConnection (.NET framework) Connection Strings
Standard Security:
<%
'declare the variable that will hold the connection string
Dim ConnectionString
'define connection string, specify database driver and location of the database
ConnectionString="Provider=SQLOLEDB;Data Source=your_server_name;" &_
"Initial Catalog= your_database_name;UserId=your_username;Password=your_password;"
%>
Trusted Connection:
<%
'declare the variable that will hold the connection string
Dim ConnectionString
'define connection string, specify database driver and location of the database
ConnectionString= "Provider=SQLOLEDB;Data Source=your_server_name;" &_
"Initial Catalog=your_database_name;Integrated Security=SSPI;"
%>
Connect via an IP address:
<%
'declare the variable that will hold the connection string
Dim ConnectionString
'define connection string, specify database driver and location of the database
ConnectionString="Provider=SQLOLEDB;Data Source=your_remote_server_ip,1433;Network Library=DBMSSOCN;" &_
"Initial Catalog=your_database_name;User ID=your_username;Password=your_password;"
%>
At the end of the Data Source is the port to use (1433 is the default)