Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Microsoft VBScript runtime error '800a000d'

What is wrong with my script?

I'm getting the following error --

""Microsoft VBScript runtime error '800a000d'
Type mismatch
/default.asp, line 30""

My script is

<!--#include file="Connections/Recruta2.asp" -->
<%

Dim DashLogin__username
DashLogin__username = ""
if(Request("username") <> "") then DashLogin__username = Request("username")

Dim DashLogin__password
DashLogin__password = ""
if(Request("password") <> "") then DashLogin__password = Request("password")

Dim DashLogin__ip
DashLogin__ip = ""
if(Request("ip") <> "") then DashLogin__ip = Request("ip")

set DashLogin = Server.CreateObject("ADODB.Command")
DashLogin.ActiveConnection = MM_Recruta2_STRING
DashLogin.CommandText = "dbo.DashboardLogin"
DashLogin.CommandType = 4
DashLogin.CommandTimeout = 0
DashLogin.Prepared = true
DashLogin.Parameters.Append DashLogin.CreateParameter("@RETURN_VALUE", 3, 4)
DashLogin.Parameters.Append DashLogin.CreateParameter("@username", 200, 1,100,DashLogin__username)
DashLogin.Parameters.Append DashLogin.CreateParameter("@password", 200, 1,100,DashLogin__password)
DashLogin.Parameters.Append DashLogin.CreateParameter("@ip", 200, 1,15,DashLogin__ip)
set Login = DashLogin.Execute
Login_numRows = 0

IF  Login.GetRows() > 0 then
dim arrLogin
arrLogin = Login.GetRows()
End if

Login.Close()
Set Login = Nothing

arrLoginCount=ubound(arrLogin,2)+1

If arrLoginCount > 0 Then
Session("UN") = arrLogin(0,0)
Session("PD") = arrLogin(1,0)
Session("IP") =arrLogin(2,0)

Response.Redirect("/default.asp?id=pass")

End if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
</head>

<body>
<div class="login">
<form id="form1" name="form1" method="post" action="">
  <div class="inputcontainer">
    <ul>
      <li>
        <label>Email :</label>
        <input name="username" type="text" id="username" maxlength="50" />
      </li>
      <li>
        <label>Password :</label>
        <input name="password" type="password" id="password" maxlength="50" />
      </li>
    </ul>
  </div>
  <div class="buttoncontainer">
    <input type="image" id="searchbut" src="img/login.png" alt="login" width="72" height="45"/>
  </div>
  <div class="remembermediv">
    <label>
      <input name="remember" type="checkbox" id="remember" value="Y" />
    </label>
    <p>Remember me</p>
  </div>
  <%
If arrLoginCount = 0 Then
%><div class="faillogin">
 Your login failed, please try again or contact the sys admin
  </div><%
End if
%>
</form>
<div style="clear:both"></div>
</div>
</body>
</html>

Open in new window


What it should do is -

If the recordset returns a row, create an array and using the details from the array create session variables and then redirect..

If the recordset is empty

display the rest of the page with a message that reads --

""Your login failed, please try again or contact the sys admin""
 
Thanks
Avatar of mlongoh
mlongoh
Flag of United States of America image

Line 30 should probably read dim arrLogin()

You're missing the () at the end.
Avatar of garethtnash

ASKER

No sorry,

This works though --

Login_numRows = 0

dim arrLogin
arrLogin = Login.GetRows()


Login.Close()
Set Login = Nothing

Open in new window


But only if Login returns a result?

So I need some kind of if statement that only creates arrLogin IF Login is not null?

How would I do that?

Cheers
SOLUTION
Avatar of mlongoh
mlongoh
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So I updated to -

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/Recruta2.asp" -->
<%

Dim DashLogin__username
DashLogin__username = ""
if(Request("username") <> "") then DashLogin__username = Request("username")

Dim DashLogin__password
DashLogin__password = ""
if(Request("password") <> "") then DashLogin__password = Request("password")

Dim DashLogin__ip
DashLogin__ip = ""
if(Request("ip") <> "") then DashLogin__ip = Request("ip")

set DashLogin = Server.CreateObject("ADODB.Command")
DashLogin.ActiveConnection = MM_Recruta2_STRING
DashLogin.CommandText = "dbo.DashboardLogin"
DashLogin.CommandType = 4
DashLogin.CommandTimeout = 0
DashLogin.Prepared = true
DashLogin.Parameters.Append DashLogin.CreateParameter("@RETURN_VALUE", 3, 4)
DashLogin.Parameters.Append DashLogin.CreateParameter("@username", 200, 1,100,DashLogin__username)
DashLogin.Parameters.Append DashLogin.CreateParameter("@password", 200, 1,100,DashLogin__password)
DashLogin.Parameters.Append DashLogin.CreateParameter("@ip", 200, 1,15,DashLogin__ip)
set Login = DashLogin.Execute
Login_numRows = 0

If NOT IsNull(Login.GetRows()) then
dim arrLogin
arrLogin = Login.GetRows()
END IF

Login.Close()
Set Login = Nothing

arrLoginCount=ubound(arrLogin,2)+1

If arrLoginCount > 0 Then
Session("UN") = arrLogin(0,0)
Session("PD") = arrLogin(1,0)
Session("IP") =arrLogin(2,0)

Response.Redirect("/default.asp?id=pass")

End if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Login</title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
</head>

<body>
<div class="login">
<form id="form1" name="form1" method="post" action="">
  <div class="inputcontainer">
    <ul>
      <li>
        <label>Email :</label>
        <input name="username" type="text" id="username" maxlength="50" />
      </li>
      <li>
        <label>Password :</label>
        <input name="password" type="password" id="password" maxlength="50" />
      </li>
    </ul>
  </div>
  <div class="buttoncontainer">
    <input type="image" id="searchbut" src="img/login.png" alt="login" width="72" height="45"/>
  </div>
  <div class="remembermediv">
    <label>
      <input name="remember" type="checkbox" id="remember" value="Y" />
    </label>
    <p>Remember me</p>
  </div>
  <%
If arrLoginCount = 0 Then
%><div class="faillogin">
 Your login failed, please try again or contact the sys admin
  </div><%
End if
%>
</form>
<div style="clear:both"></div>
</div>
</body>
</html>

Open in new window


but now I get this -


ADODB.Recordset error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/default.asp, line 30

When the recordset is empty
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you