Welcome to WebmasterWorld Guest from 54.226.183.49

Forum Moderators: ocean10000

Message Too Old, No Replies

Help with ADODB Query to Access in ASP

Error 800A0401

     

jimhill10

7:21 pm on Jan 30, 2005 (gmt 0)

10+ Year Member



Can someone find the error here which is reported on line 21, this is bugging me. I had to move the top level of the web site up from the /www root and eliminate this folder altogether, flattening everything, due to my web hosting service not knowing how to use their IIS manager.

This is the line reporting the error:
Rs.ActiveConnection = "FILEDSN=&session("dataLocation")&"christiansf_TheData.dsn"

Here is the code:

<%@ Language=VBScript %>
<%

UserName = Request.Form("login")
Password = Request.Form("password")
if ( Username = "" or Password = "") then
Response.Redirect "login.htm"
end if

'Set conn = Server.CreateObject("ADODB.Connection")
'conn.Open(Application("jamesmhill_ConnectionString"))
'conn.Open "FILEDSN=E:\Web\christiansf\_database\christiansf_TheData.dsn"
'sql = "select * from data"
strQuery = "SELECT * FROM UFC_Users_Table " &_
"WHERE userName = '" & UserName & "' AND " &_
"password = '" & Password & "'"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "FILEDSN="&session("dataLocation")&"christiansf_TheData.dsn"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.ActiveConnection = "FILEDSN=&session("dataLocation")&"christiansf_TheData.dsn"
Rs.Open strQuery, Conn, 3, 3

If(Conn.State = 1) Then
'1 - State Open, 0 - State Closed
'This is what we do if we opened okay
'Construct a query


set rs = conn.Execute(strQuery)
if(rs.EOF or (Err.number > 0)) then
'Failed to log in
%><HTML>
<BODY bgcolor="white">
<p>Your login failed! Click <a href="login.htm">here</a> to try again.</p>
<%
else
'Successful login
Session("ENABLED") = true
Session("USERNAME") = rs("userName")
Session("REALNAME") = rs("realName")
Session("ACCESSLEVEL") = rs("accessLevel")
if rs("webadmin") then
Session("webadmin") = rs("webadmin")
end if

'Close database connection
conn.Close
set conn = Nothing
'Response.Redirect "menu.asp"
auth = 1
end if
else
Response.Write("<BODY background=../myadmin/backgd.gif>Connection Failed. <BR> " & Err.Description )
end if

'conn.Close
set conn = Nothing
%>
</BODY>
</HTML>
<%if auth = 1 then%>
<SCRIPT LANGUAGE="JavaScript">
<!--
parent.TopLogo.location.href="TopWithMenu.asp";
window.location.href="menu.asp";
//-->
</SCRIPT>
<%end if%>

txbakers

8:00 pm on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member txbakers is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Hi and Welcome to the Webmaster World!

Rs.ActiveConnection = "FILEDSN=&session("dataLocation")&"christiansf_TheData.dsn"

You have an extra quote mark before christiansf_TheData

There are three quotes in that string, beside the two for the session variable.

jimhill10

9:02 pm on Jan 30, 2005 (gmt 0)

10+ Year Member



Tried that to no avail. This is the way it was on the other server that worked, before they made me change the DSN with the underscore character in it and the prefix:

strQuery = "SELECT * FROM UFC_Users_Table " &_
"WHERE userName = '" & UserName & "' AND " &_
"password = '" & Password & "'"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "FILEDSN="&session("dataLocation")&"TheData.dsn"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.ActiveConnection = "FILEDSN="&session("dataLocation")&"TheData.dsn"
Rs.Open strQuery, Conn, 3, 3

syber

12:20 am on Jan 31, 2005 (gmt 0)

10+ Year Member



You need to use the MapPath method to map a virtual address to a physical address.

Conn.Open "FILEDSN=" & Server.MapPath("christiansf_TheData.dsn")

jimhill10

4:57 am on Jan 31, 2005 (gmt 0)

10+ Year Member



Thanks much, I am on the trail now. I have other errors I am working on after this one.

Zaphod Beeblebrox

7:12 am on Jan 31, 2005 (gmt 0)

10+ Year Member



Just compare the two, and spot the missing "

Rs.ActiveConnection = "FILEDSN=&session("dataLocation")&"christiansf_TheData.dsn"
Rs.ActiveConnection = "FILEDSN="&session("dataLocation")&"TheData.dsn"

 

Featured Threads

Hot Threads This Week

Hot Threads This Month