Solved

Cannot conect to Access 2007 using ASP

Posted on 2008-06-26
2
426 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now