HomeASP HostingWeb DesignRegister DomainSupportAbout Us

FAQ
Support :: FAQ


How to connect to MS SQL Server database from ASP
Before you can access your MS SQL Server database from ASP, you need to connect to it using one of the following methods:

1. Connect to a MS SQL Server database with OLE DB:

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=SQLOLEDB; Data Source=YOUR_SERVER_NAME; Initial
Catalog=your_database_name; User ID=your_username; Password=your_password"
objConn.Close
Set objConn = Nothing

2. Connect to a MS SQL Server database with SQL Driver:

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Driver={SQL Server};" & _
"Server=YOUR_SERVER_NAME;" & _
"Database=your_database_name;" & _
"Uid=your_username;" & _
"Pwd=your_password;"
objConn.Close
Set objConn = Nothing
Copyright 2001-2004 Art Branch Inc.