Solved

Cannot conect to Access 2007 using ASP

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dreamweaver server behavior gone 6 138
Auto Submit on dropdown box 14 66
ASP Button to clear text 4 56
Syntax for query to update table 2 14
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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

803 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