?
Solved

Cannot conect to Access 2007 using ASP

Posted on 2008-06-26
2
Medium Priority
?
438 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 225 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

770 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