homepage Welcome to WebmasterWorld Guest from 54.205.168.88
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
Forum Library, Charter, Moderators: ocean10000

Microsoft IIS Web Server and ASP.NET Forum

    
Help with ADODB Query to Access in ASP
Error 800A0401
jimhill10




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

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




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

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




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

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




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

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




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

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

Zaphod Beeblebrox




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

Just compare the two, and spot the missing "

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Microsoft / Microsoft IIS Web Server and ASP.NET
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved