Forum Moderators: open

Message Too Old, No Replies

Beginner Help connection to Access DB using .ASP

cant get connection to work!

         

yoda84

5:51 pm on May 10, 2006 (gmt 0)

10+ Year Member



Hey guys,
just found your great site and decieded here would be the best place to look for help. Im a complete beginner at .ASP and have a project todo.

I've installed IIS and set up an ODBC connection to my database, but when ever i try to connect i get the following error:
#####################################################
Technical Information (for support personnel)

* Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4E)
Operation was canceled.
/query.asp, line 11

* Browser Type:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3

* Page:
GET /query.asp

* Time:
10 May 2006, 18:43:57

* More information:
Microsoft Support
#####################################################

Heres my .ASP page source.....what am i doing wrong? its really annoying me now and I just can't seem to correct the problem.
Thanks in advance guys.
yoda84 aka Daz
#####################################################

<html>
<head>
<title>
</title>
</head>
<body>
<%Query="SELECT * FROM Customer"

Set MyConn = Server.CreateObject("ADODB.Connection")
conString = "DBQ=" & Server.MapPath("userinfo.mdb")
Myconn.Open "DRIVER={Microsoft access Driver (*.mdb)}; " & conString
set RSlist = server.CreateObject("ADODB.recordset")
RSlist.Open Query,userinfo,3%>

<h2>RESULTS:</h2>

<table border="1">

<%Do While Not RSlist.EOF%>
<tr>
<td><%Response.write(RSlist("userLevel"))%></td>
<td><%Response.write(RSlist("userName"))%></td>
<td><%Response.write(RSlist("userPassword"))%></td>
<td><%Response.write(RSlist("userEmail"))%></td>
</tr>
<%RSlist.MoveNext
loop%>

</table>
</body>
</html>

emsaw

8:34 pm on May 10, 2006 (gmt 0)

10+ Year Member



yoda84,
you could try the Jet driver.. never had much luck using the native ODBC:

conString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ 
"Data Source=" & Server.MapPath("userinfo.mdb")
Myconn.Open conString

** side note**: if you aren't already.. remember to close and dispose of your recordset and connection.

hth,
Mark

yoda84

5:38 pm on May 11, 2006 (gmt 0)

10+ Year Member



still no joy :(

I have found another way of getting it to work using this tutorial:

[kamath.com...]

Is it still OK to use this style on connection, as I noticed that the tutorial is form 1998.

Im getting really frustrated with it all at the moment.
thanks for the help

Daz