strange error

K

Kevin

Hi,

With this, i get the error:
" Microsoft VBScript runtime error '800a01ca'
Variable uses an Automation type not supported in VBScript "
at line 79

<%
totintot=request.cookies("totintot")
....
sql = "select count(*) as totuur from studres where dag>= curdate() group by
logon having logon='" & lol & "';" Set rs = objdc.execute(sql)
if rs.eof then
totu=0
else
rsArray = rs.GetRows()
totu = rsArray(0,0)
end if

if int(totu)>=int(totintot) then flgmax=1 'this is line 79
rs.close
%>

With this : if totu>=int(totintot) then flgmax=1 => type mismatch

Any idea?
Thanks
Chris
 
J

Jevon

At a guess, you're trying to cast a NULL to int - what's the value of totu?

Jevon
 
K

Kevin

Thanks for replying...

Totintot = 10
totu = 1

The database is Mysql, but i suppose it' not relevant.
 
B

Bob Barrows [MVP]

Kevin said:
Hi,

With this, i get the error:
" Microsoft VBScript runtime error '800a01ca'
Variable uses an Automation type not supported in VBScript "
at line 79

<%
totintot=request.cookies("totintot")
...
sql = "select count(*) as totuur from studres where dag>= curdate()
group by logon having logon='" & lol & "';"

This has nothing to do with your error but: this query is less efficient
than it could be. Change it to:

sql = "select count(*) as totuur from studres " & _
"where dag>= curdate() AND logon='" & lol & "';"

Since you're only interested in a specific logon, there is no need to force
the database to go to the extra time and expense to group by logon and then
filter by logon after the table has been grouped and aggregated.

Set rs = objdc.execute(sql)
if rs.eof then
totu=0
else
rsArray = rs.GetRows()
totu = rsArray(0,0)

Again, probably nothing to do with your error, but this is overkill. There
is no need to waste CPU and memory by moving this single record into an
array. Simply do this:
totu=rs(0).value

totu=rs(0).value & ""

In fact, this query should never return an empty recordset: you should
always get back a record containing 0 or higher in the first field, so
testing for eof is not really necessary (it IS a good habit to get into, so
consider this paragraph to be informational only).
if int(totu) >=int(totintot) then flgmax=1 'this is line 79
rs.close
%>

With this : if totu>=int(totintot) then flgmax=1 => type mismatch
You need to figure out which variable it is talking about (I suspect totu is
the problem, but ...):

Response.Write totintot & ": " & typename(totitntot) & "<BR>"
Response.Write totu & ": " & typename(totu) & "<BR>"
Response.Write flgmax & ": " & typename(flgmax) & "<BR>"

on error resume next
Response.Write int(totu) & "<BR>"
if err<>0 then
response.write "totu could not be converted to int" & "<BR>"
end if
Response.Write int(totitntot) & "<BR>"
if err<>0 then
response.write "totitntot could not be converted to int" & "<BR>"
end if

Bob Barrows
 
K

Kevin

ok, thanks

Bob Barrows said:
This has nothing to do with your error but: this query is less efficient
than it could be. Change it to:

sql = "select count(*) as totuur from studres " & _
"where dag>= curdate() AND logon='" & lol & "';"

Since you're only interested in a specific logon, there is no need to force
the database to go to the extra time and expense to group by logon and then
filter by logon after the table has been grouped and aggregated.



Again, probably nothing to do with your error, but this is overkill. There
is no need to waste CPU and memory by moving this single record into an
array. Simply do this:
totu=rs(0).value

totu=rs(0).value & ""


In fact, this query should never return an empty recordset: you should
always get back a record containing 0 or higher in the first field, so
testing for eof is not really necessary (it IS a good habit to get into, so
consider this paragraph to be informational only).

You need to figure out which variable it is talking about (I suspect totu is
the problem, but ...):

Response.Write totintot & ": " & typename(totitntot) & "<BR>"
Response.Write totu & ": " & typename(totu) & "<BR>"
Response.Write flgmax & ": " & typename(flgmax) & "<BR>"

on error resume next
Response.Write int(totu) & "<BR>"
if err<>0 then
response.write "totu could not be converted to int" & "<BR>"
end if
Response.Write int(totitntot) & "<BR>"
if err<>0 then
response.write "totitntot could not be converted to int" & "<BR>"
end if

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
 
K

Kevin

One more question, please...

The sql commands are of course dependant of the database (sql with MS access
will have a different syntax than with Mysql), but the vbscript written in
ASP, is it independant of the db, no? I noticed with the same application,
but one with ms access, the other with mysql and adapted sql syntax,
differences in the return of variables and in methods e.g. rs.RecordCount)
Thanks
 
B

Bob Barrows [MVP]

It is possible. Different database providers may provide varying levels of
support for some methods/properties.
RecorCount will only work if the cursor you are using supports Bookmarks.
This will be true of all client-side cursors (adUseClient) and some
server-side cursors depending on provider support.
 
K

Kevin

Thanks

Bob Barrows said:
It is possible. Different database providers may provide varying levels of
support for some methods/properties.
RecorCount will only work if the cursor you are using supports Bookmarks.
This will be true of all client-side cursors (adUseClient) and some
server-side cursors depending on provider support.



--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top