Article ID: 313062 - Last Review: November 1, 2006 - Revision: 7.3 HOW TO: Connect to a Database by Using Active Server Pages in Windows 2000
This article was previously published under Q313062 On This PageSUMMARY This step-by-step article describes how to connect to a
database by using an Active Server Pages (ASP) Web page. Create a Data Source NameTo connect to a database by using ASP pages, you must first create a Data Source Name (DSN) on the Web server for the type of database to which you want to connect. To do so, use one of the following methods.For a Database ProgramTo create a DSN for a database program (such as Microsoft Access):
For a Database ServerTo create a DSN for an SQL Server:
Create an ASP Script to Connect to the Database by Using the DSNIn your ASP script, create a connection to the database by using the ActiveX Data Objects (ADO) Database Access Component (DAC):
ExampleThe following example illustrates how to connect to the Microsoft Access NorthWind sample database by using an ASP script.NOTE: This example assumes the default installation of Windows 2000 on drive C, as well as the default installation of Microsoft Access along with the NorthWind sample database. Step 1: Create a DSNFollow the steps in the For a Database Program section of this article to create a DSN to the Microsoft Access Northwind.mdb sample database.NOTE: By default, the Northwind.mdb file is located in the C:\Program Files\Microsoft Office\Office\Samples folder. Step 2: Create an ASP Page
Step 3: Test the ASP Page
TroubleshootingIf you experience difficulty connecting to a database by using ASP Web pages, verify that you have sufficient permissions to access the database:
REFERENCESFor additional information about how to work with
ASP pages, click the article numbers below to view the articles in the
Microsoft Knowledge Base: 308164
(http://support.microsoft.com/kb/308164/EN-US/
)
HOW TO: Create and Configure ASP Web Applications
165492
(http://support.microsoft.com/kb/165492/EN-US/
)
HOWTO: Use ADO with a Visual Foxpro Database
For additional information about SQL Server, please
view the following Microsoft Web site: http://www.microsoft.com/SQL
(http://www.microsoft.com/SQL)
For additional information about Microsoft Scripting
technologies, please view the following Microsoft Web sites: http://msdn.microsoft.com/en-us/library/ms950396.aspx
(http://msdn.microsoft.com/en-us/library/ms950396.aspx)
http://msdn.microsoft.com/en-us/default.aspx
(http://msdn.microsoft.com/en-us/default.aspx)
For additional information about ODBC, please view the following
Microsoft Web site: http://msdn.microsoft.com/en-us/library/ms710252(VS.85).aspx
(http://msdn.microsoft.com/en-us/library/ms710252(VS.85).aspx)
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top
