Website Domain Registration and Website Hosting - Host a Website Tonight
GoWebsite.com provides Domain Registration
Website Hosting, On-Line Shopping Carts, SEO
Blog Hosting, Email Accounts, Security Certificates,
Merchant Accounts & other Website Products.
Free setup! Speak with us anytime: 480-624-2500
Domain Registration

Connecting to an Access Database Using File DSN and ASP/ADO

This example describes using File DSN and ASP/ADO to connect to an Access Database. For help connecting to your Database with Alias Domains, see Finding Your Hosting Account's Absolute Path.

Replace the db_ fields with the information for your database from the Hosting Control Panel. For more information, see Locating Your MS SQL Database Connection Strings for more information.

<%
Dim oConn, oRs
Dim qry, connectstr, sDSNDir
Dim db_name, db_username, db_userpassword
Dim dsn_name

dsn_name = "your_dsn_name"
fieldname = "your_fieldname"
tablename = "your_tablename"

'assumes that _dsn exists in the root
sDSNDir = Server.MapPath("\_dsn")

connectstr = "filedsn=" & sDSNDir & "\" & dsn_name

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)

if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & " "
oRS.movenext
wend
oRS.close
end if

Set oRs = nothing
Set oConn = nothing

%>

NOTE: Web Hosting accounts do not support Access databases. See Am I using Classic Hosting or Web Hosting? for more information.

Domain Registration Domain Registration
Pay less for website domain names. Register your own .com, .net or .org for as low as $10.18 per year. Everything you need to get online - FREE with your domain.
Website Hosting Website Builder
For as little as $3.89 per month you can build your Website online with Website Builder using our easy to use professional templates.
Play Video - Demo
Shopping Cart Software Quick Shopping Cart
Build and run your own successful online store in minutes! You're just five easy steps away!
Play Video
Website Hosting Website Hosting
Everything you need to give your Website the high-performance home it deserves!  Protect transactions and customer data with a
SSL Certificate