Solved

Cannot conect to Access 2007 using ASP

Posted on 2008-06-26
2
425 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
Comment Utility
and what is your problem?

should the file extension be .mdb
0
 
LVL 2

Accepted Solution

by:
jweissdandm earned 75 total points
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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 …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

10 Experts available now in Live!

Get 1:1 Help Now