Solved

Cannot conect to Access 2007 using ASP

Posted on 2008-06-26
2
429 Views
Last Modified: 2012-06-21
Hi I am having some problems connecting to my Access 2007 database.
Can anyone help?
Thanks
<%
	Set objConn = Server.CreateObject("ADODB.Connection")
	ConnStr = "DRIVER={Microsoft Access Driver (*.mdb,*.accdb)}; "
	ConnStr = ConnStr & "DBQ=" & Server.MapPath("database\db.accdb")
	Response.Write(ConnStr)
	objConn.Open(ConnStr)
	
	Set objRS = objConn.Execute("SELECT * FROM table1")
	
	While not objRS.EOF
		Response.Write(objRS("name"))
		objRS.movenext
	Wend
	
	objRS.Close
	Set objRS = Nothing
	objConn.Close
	Set objConn = Nothing
%>

Open in new window

0
Comment
Question by:ricteo
2 Comments
 
LVL 7

Expert Comment

by:Dauhee
ID: 21878099
and what is your problem?

should the file extension be .mdb
0
 
LVL 2

Accepted Solution

by:
jweissdandm earned 75 total points
ID: 21891470
what about this
<%
dataSource = "D:\path_to_database.mdb"	
 
 
set Myconn = Server.CreateObject("ADODB.Connection")
MyConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&dataSource&""
MyConn.Open MyConnString
 
'grab data and add it to an array
set rs = MyConn.execute ("SELECT * from myTable")
array1 = rs.getRows()
rs.close
set rs = nothing
 
%>

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question