When you think ASP, think...
logo
spgif
search
spgif
site-index
spgif
Recent Articles xml
All Articles
ASP.NET Articles
ASPFAQs.com
Related Web Technologies
User Tips!
Coding Tips
spgif
spgif spgif
spgif

leftnav-resources
spgif
Sections:
Sample Chapters
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
XML Info
Information:
Feedback
Author an Article
spgif
spgif spgif
ASP ASP.NET ASP FAQs Feedback topnav-right
right-bg
Print this page.
Published: Monday, November 16, 1998

Connecting to a Database


If you want to connect to a database, there are several ways you can do it using ASP. I suggest using a DSN on your server, although you can use a connection string if you like. Let's assume you have a System DSN on your server named "MyDatabase", which points to an Access database. Here is what you could write in your ASP page to connect to the database:

- continued -

<%

'Create a connection to the database
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
'Open the connection
Conn.Open "MyDatabase"
%>

That's all there is to connecting to a database. You can now query the database, update records, delete records, etc.

Happy Programming!


ASP.NET [1.x] [2.0] | ASPFAQs.com | Advertise | Feedback | Author an Article