Home page
 
 Home 
 ASP 
 PHP 
 SQL 
 HTML 
 JavaScript 
 Search 
 Contact 
 
Search
or browse popular tags
ASP Tutorial
Subscription

Sign up for the free email newsletter for new tips, tutorials and more. Enter your email address below, and then click the button.

Privacy Policy

RSS Twitter

MS SQL Server Connection Strings

Print

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)




Tags:

Add To: Add to dzone dzone | Digg this digg | Add to del.icio.us del.icio.us | Stumble it stumbleupon

  • Comments





Copyright © 2005-2019             www.WebCheatSheet.com All Rights Reserved.