Home - Help & Support - Contact Us
    

Connecting To An Access Database Using ASP Or ADO

This example describes using ASP/ADO to connect to an Access Database.

<%
Dim oConn, oRs
Dim qry, connectstr
Dim db_path
Dim db_dir
db_dir = Server.MapPath("access_db")
db_path = db_dir & "yourdatabasefile.mdb"
fieldname = "your_field"
tablename = "your_table"

connectstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & db_path

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

%>
Rated:NR/0 Votes
522 Views
More Articles From ASP
More Articles From ASP
Print Article
Print
Share |
Comments, Questions & Reviews

Comments is currently disabled for this article!
Related Articles and Readings
Connecting to an Access Database Using File DSN and ASP or ADO
This example describes using File DSN and ASP/ADO to connect to an Access Database. <%Dim oConn, oRsDim qry, connectstr, sDSNDirDim db_name, ...
Connecting to a MySQL Database Using File DSN and ASP or ADO
This example describes using File DSN and ASP/ADO to connect to a MySQL Database. <%Dim oConn, oRsDim qry, connectstr, sDSNDirDim db_name, ...
Connecting to a MySQL Database Using ASP or ADO
This example describes using ASP/ADO to connect to a MySQL Database. <%Dim oConn, oRsDim qry, connectstrDim db_name, db_username, db_userpasswordDim db_serverdb_server = ...
Connecting to a Microsoft SQL Server Database Using ASP/ADO
This example describes using ASP/ADO to connect to a Microsoft SQL Server Database. <%'Sample Database Connection Syntax for ASP and SQL ...
Is there functionality that is not available to my Windows virtual dedicated server?
Due to the nature of virtualization software, some system functionality is not available to the administrator of a virtual dedicated ...
The information provided in this article is for general information and/or the comments is the sole responsibility of their respective authors and does not necessarily reflect the opinion of zeronese.net does not endorse any article and/or comments published by our web users unless otherwise noted.