Forum Moderators: open
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%>
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