Knowledgebase
Portal Home > Knowledgebase > Windows Hosting > MsSql database > Connecting to MSSQL with out a DSN
Connecting to MSSQL with out a DSN
| You can use the following string to connect to MSSQL with out a DSN. It uses an OLEDB connection string to connect to a Microsoft SQL Server 200 database from within ASP:
<% Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB; Data Source =mssql.server.com; Initial Catalog = mydatabase; User Id = USER; Password=PASSWORD; Network Library=dbmssocn;"
If conn.errors.count = 0 Then
Response.Write "Connected OK"
End If %>
In the example above, mssql.server.com is the MSSQL server, USER is the username and PASSWORD is the password which was provided to you in your MSSQL account setup mail
|
Add to Favourites
Print this Article
|
Powered by WHMCompleteSolution