Link to home
Start Free TrialLog in
Avatar of coerrace
coerrace

asked on

VBS Runtime error 800A000D - Type mismatch

Hello i have this code:

<%@ LANGUAGE="VBSCRIPT" %>

<%
Function RndStr(Length, UseChrs)
 If IsNull(UseChrs) OR (UseChrs = "") Then UseChrs = "0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*()_+=-"
 NewStr = ""
 Randomize(CByte(Left(Right(Time(),5),2)))
 For gpIndex = 1 To Length
  NewStr = NewStr & Mid(UseChrs, Int((Len(UseChrs)) * Rnd + 1), 1)
 Next
 RndStr = NewStr
End Function
%>

<HTML>
<HEAD>
<TITLE>Info</TITLE>
</HEAD>
<BODY  bgcolor="#FFFFFF">

<font face="Arial" color="#000000" size ="2">

<br>
<textarea rows="20" cols="200" STYLE="font-family: Arial; font-size: 12px; background-color: #E8E8E8; word-wrap: normal; overflow: auto;">


Cookie = "<%= RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")%>"
Password = "<%= RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")%>"

</textarea>

</font>

</BODY>
</HTML>

Open in new window


   But when I run i get this error "VBS Runtime error 800A000D - Type mismatch"
Any know why is not working or what is needed to change to make work?
Thank you
Avatar of Big Monty
Big Monty
Flag of United States of America image

What line is the error occurring?
Avatar of coerrace
coerrace

ASKER

This area:

Cookie = "<%= RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")%>"
Password = "<%= RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")%>"

Open in new window

Try running the code directly (not through the function) that should give you a better sense where the error occurs
I used this:

<%

 If IsNull(UseChrs) OR (UseChrs = "") Then UseChrs = "0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*()_+=-"
 NewStr = ""
 Randomize(CByte(Left(Right(Time(),5),2)))
 For gpIndex = 1 To Length
  NewStr = NewStr & Mid(UseChrs, Int((Len(UseChrs)) * Rnd + 1), 1)
 Next
 RndStr = NewStr
 CookieEncryptionKey = RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")
 PasswordEncryptionKey = RndStr(40,"0123456789abcdefghijklmnopqrstuvwxyz")
 Response.write (CookieEncryptionKey)
Response.write ("pass" & PasswordEncryptionKey)


%>

Open in new window



   And now the error say:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'CByte'
Change cbyte to cdbl
ASKER CERTIFIED SOLUTION
Avatar of coerrace
coerrace

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
Solved