Search the Knowledgebase Browse by Category
      Home       Web Hosting       Web Hosting Guide       Sample Scripts (Windows)
   MsSQL Server Connection Strings - ODBC, OLE DB
The MsSQL Server Connection Strings can be declared in variety of formats some of the standard formats are as follows :


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;"
%>


Live Support

If you have any questions at all, please don't hesitate to contact us

+91.22.28663101, 66789456

To submit Support ticket, click here


     Related FAQs
Setting up feedback form using ASP
Using AspEmail in ASP and ASP.Net
Using CDO (Collaboration Data Objects)
Connecting to MsSQL using DSN (Windows)
Connecting to MsSQL using DSN-less connection (Windows only)
File upload using Asp and Asp.Net
MsSQL Server Connection Strings - ODBC, OLE DB