[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

Cannot conect to Access 2007 using ASP

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
ricteo
Asked:
ricteo
1 Solution
 
DauheeCommented:
and what is your problem?

should the file extension be .mdb
0
 
jweissdandmCommented:
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now