Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Microsoft VBScript runtime error '800a0006'


Message #1 by "damian lynch" <damian.lynch@o...> on Mon, 23 Sep 2002 12:08:38
What does this overflow error mean?

Thanking in advance.

Heres the code.

<%

Dim Cat1a, totala1, totala2, totala3, totala4, totala5, totala6, totala7, 
totala8, totala9, totala10 
Cat1a = 0
totala1 = 0
totala2 = 0
totala3 = 0
totala4 = 0
totala5 = 0
totala6 = 0
totala7 = 0
totala8 = 0
totala9 = 0
totala10 = 0
set rsFocus2_Cat1_a_q1 = Server.CreateObject("ADODB.Recordset")
rsFocus2_Cat1_a_q1.ActiveConnection = MM_ConnClimateSurvey_STRING
rsFocus2_Cat1_a_q1.Source = "SELECT Count(Q1) as totala1  FROM 
Climate_Survey  WHERE Q1 LIKE '%a1%'"
rsFocus2_Cat1_a_q1.CursorType = 0
rsFocus2_Cat1_a_q1.CursorLocation = 2
rsFocus2_Cat1_a_q1.LockType = 3
rsFocus2_Cat1_a_q1.Open()
rsFocus2_Cat1_a_q1_numRows = 0
'Response.Write(rsFocus2_Cat1_a_q1("totala1"))
Cat1a = Cat1a + totala1
'totala = 0
'while NOT rsFocus2_Cat1_a_q1.EOF
'totala = totala + 1
'rsFocus2_Cat1_a_q1.MoveNext
'wend 
%>

<%
rsFocus2_Cat1_a_q1.Close()
set rsFocus2_Cat1_a_q1 = nothing
%>
<%

%>
<%
set rsFocus2_Cat1_a_q10a = Server.CreateObject("ADODB.Recordset")
rsFocus2_Cat1_a_q10a.ActiveConnection = MM_ConnClimateSurvey_STRING
rsFocus2_Cat1_a_q10a.Source = "SELECT Count(Q10a) as totala2  FROM 
Climate_Survey  WHERE Q10a LIKE '%a1%'"
rsFocus2_Cat1_a_q10a.CursorType = 0
rsFocus2_Cat1_a_q10a.CursorLocation = 2
rsFocus2_Cat1_a_q10a.LockType = 3
rsFocus2_Cat1_a_q10a.Open()
rsFocus2_Cat1_a_q10a_numRows = 0
'totala = 0
'while NOT rsFocus2_Cat1_a_q10a.EOF
'totala = totala + 1
'rsFocus2_Cat1_a_q10a.MoveNext
'wend 
%>
<%
rsFocus2_Cat1_a_q10a.Close()
set rsFocus2_Cat1_a_q10a = nothing
%>
<%
Cat1a = Cat1a + totala2
%>
<%
set rsFocus2_Cat1_a_q10b = Server.CreateObject("ADODB.Recordset")
rsFocus2_Cat1_a_q10b.ActiveConnection = MM_ConnClimateSurvey_STRING
rsFocus2_Cat1_a_q10b.Source = "SELECT Count(Q10b) as totala3  FROM 
Climate_Survey  WHERE Q10b LIKE '%a1%'"
rsFocus2_Cat1_a_q10b.CursorType = 0
rsFocus2_Cat1_a_q10b.CursorLocation = 2
rsFocus2_Cat1_a_q10b.LockType = 3
rsFocus2_Cat1_a_q10b.Open()
rsFocus2_Cat1_a_q10b_numRows = 0
'totala = 0
'while NOT rsFocus2_Cat1_a_q10b.EOF
'totala = totala + 1
'rsFocus2_Cat1_a_q10b.MoveNext
'wend 
%>
<%
rsFocus2_Cat1_a_q10b.Close()
set rsFocus2_Cat1_a_q10b = nothing
%>
<%
Cat1a = Cat1a + totala3
%>
<%
set rsFocus2_Cat1_a_q10c = Server.CreateObject("ADODB.Recordset")
rsFocus2_Cat1_a_q10c.ActiveConnection = MM_ConnClimateSurvey_STRING
rsFocus2_Cat1_a_q10c.Source = "SELECT Count(Q10c) as totala4  FROM 
Climate_Survey  WHERE Q10c LIKE '%a1%'"
rsFocus2_Cat1_a_q10c.CursorType = 0
rsFocus2_Cat1_a_q10c.CursorLocation = 2
rsFocus2_Cat1_a_q10c.LockType = 3
rsFocus2_Cat1_a_q10c.Open()
rsFocus2_Cat1_a_q10c_numRows = 0
'totala = 0
'while NOT rsFocus2_Cat1_a_q10c.EOF
'totala = totala + 1
'rsFocus2_Cat1_a_q10c.MoveNext
'wend 
%>
<%
rsFocus2_Cat1_a_q10c.Close()
set rsFocus2_Cat1_a_q10c = nothing
%>
<%
Cat1a = Cat1a + totala4
%>
<%
set rsFocus2_Cat1_a_q16 = Server.CreateObject("ADODB.Recordset")
rsFocus2_Cat1_a_q16.ActiveConnection = MM_ConnClimateSurvey_STRING
rsFocus2_Cat1_a_q16.Source = "SELECT Count(Q16) as totala5  FROM 
Climate_Survey  WHERE Q16 LIKE '%a1%'"
rsFocus2_Cat1_a_q16.CursorType = 0
rsFocus2_Cat1_a_q16.CursorLocation = 2
rsFocus2_Cat1_a_q16.LockType = 3
rsFocus2_Cat1_a_q16.Open()
rsFocus2_Cat1_a_q16_numRows = 0
'totala = 0
'while NOT rsFocus2_Cat1_a_q16.EOF
'totala = totala + 1
'rsFocus2_Cat1_a_q16.MoveNext
'wend 
%>
<%
rsFocus2_Cat1_a_q16.Close()
set rsFocus2_Cat1_a_q16 = nothing
%>
<%
Cat1a = Cat1a + totala5
%>
<%
set rsFocus2_Cat1_a_q27 = Server.CreateObject("ADODB.Recordset")
rsFocus2_Cat1_a_q27.ActiveConnection = MM_ConnClimateSurvey_STRING
rsFocus2_Cat1_a_q27.Source = "SELECT Count(Q27) as totala6  FROM 
Climate_Survey  WHERE Q27 LIKE '%a1%'"
rsFocus2_Cat1_a_q27.CursorType = 0
rsFocus2_Cat1_a_q27.CursorLocation = 2
rsFocus2_Cat1_a_q27.LockType = 3
rsFocus2_Cat1_a_q27.Open()
rsFocus2_Cat1_a_q27_numRows = 0
'totala = 0
'while NOT rsFocus2_Cat1_a_q27.EOF
'totala = totala + 1
'rsFocus2_Cat1_a_q27.MoveNext
'wend 
%>
<%
rsFocus2_Cat1_a_q27.Close()
set rsFocus2_Cat1_a_q27 = nothing
%>
<%
Cat1a = Cat1a + totala6
%>
<%
set rsFocus2_Cat1_a_q31 = Server.CreateObject("ADODB.Recordset")
rsFocus2_Cat1_a_q31.ActiveConnection = MM_ConnClimateSurvey_STRING
rsFocus2_Cat1_a_q31.Source = "SELECT Count(Q31) as totala7  FROM 
Climate_Survey  WHERE Q31 LIKE '%a1%'"
rsFocus2_Cat1_a_q31.CursorType = 0
rsFocus2_Cat1_a_q31.CursorLocation = 2
rsFocus2_Cat1_a_q31.LockType = 3
rsFocus2_Cat1_a_q31.Open()
rsFocus2_Cat1_a_q31_numRows = 0
'totala = 0
'while NOT rsFocus2_Cat1_a_q31.EOF
'totala = totala + 1
'rsFocus2_Cat1_a_q31.MoveNext
'wend 
%>
<%
rsFocus2_Cat1_a_q31.Close()
set rsFocus2_Cat1_a_q31 = nothing
%>
<%
Cat1a = Cat1a + totala7
%>
<%
set rsFocus2_Cat1_a_q36 = Server.CreateObject("ADODB.Recordset")
rsFocus2_Cat1_a_q36.ActiveConnection = MM_ConnClimateSurvey_STRING
rsFocus2_Cat1_a_q36.Source = "SELECT Count(Q36) as totala8  FROM 
Climate_Survey  WHERE Q36 LIKE '%a1%'"
rsFocus2_Cat1_a_q36.CursorType = 0
rsFocus2_Cat1_a_q36.CursorLocation = 2
rsFocus2_Cat1_a_q36.LockType = 3
rsFocus2_Cat1_a_q36.Open()
rsFocus2_Cat1_a_q36_numRows = 0
'totala = 0
'while NOT rsFocus2_Cat1_a_q36.EOF
'totala = totala + 1
'rsFocus2_Cat1_a_q36.MoveNext
'wend 
%>
<%
rsFocus2_Cat1_a_q36.Close()
set rsFocus2_Cat1_a_q36 = nothing
%>
<%
Cat1a = Cat1a + totala8
%>
<%
set rsFocus2_Cat1_a_q41 = Server.CreateObject("ADODB.Recordset")
rsFocus2_Cat1_a_q41.ActiveConnection = MM_ConnClimateSurvey_STRING
rsFocus2_Cat1_a_q41.Source = "SELECT Count(Q41) as totala9  FROM 
Climate_Survey  WHERE Q41 LIKE '%a1%'"
rsFocus2_Cat1_a_q41.CursorType = 0
rsFocus2_Cat1_a_q41.CursorLocation = 2
rsFocus2_Cat1_a_q41.LockType = 3
rsFocus2_Cat1_a_q41.Open()
rsFocus2_Cat1_a_q41_numRows = 0
'totala = 0
'while NOT rsFocus2_Cat1_a_q41.EOF
'totala = totala + 1
'rsFocus2_Cat1_a_q41.MoveNext
'wend 
%>
<%
rsFocus2_Cat1_a_q41.Close()
set rsFocus2_Cat1_a_q41 = nothing
%>
<%
Cat1a = Cat1a + totala9
%>
<%
set rsFocus2_Cat1_a_q65 = Server.CreateObject("ADODB.Recordset")
rsFocus2_Cat1_a_q65.ActiveConnection = MM_ConnClimateSurvey_STRING
rsFocus2_Cat1_a_q65.Source = "SELECT Count(Q65) as totala10  FROM 
Climate_Survey  WHERE Q65 LIKE '%a1%'"
rsFocus2_Cat1_a_q65.CursorType = 0
rsFocus2_Cat1_a_q65.CursorLocation = 2
rsFocus2_Cat1_a_q65.LockType = 3
rsFocus2_Cat1_a_q65.Open()
rsFocus2_Cat1_a_q65_numRows = 0
Cat1a = Cat1a + totala10
'totala = 0
'while NOT rsFocus2_Cat1_a_q65.EOF
'totala = totala + 1
'rsFocus2_Cat1_a_q65.MoveNext
'wend 
%>
<%
rsFocus2_Cat1_a_q65.Close()
set rsFocus2_Cat1_a_q65 = nothing
%>
<%
'Cat1a = totala1 + totala2 + totala3 +totala4 + totala5 + totala6 + 
totala7 + totala8 + totala9 + totala10
totala1 = 0
totala2 = 0
totala3 = 0
totala4 = 0
totala5 = 0
totala6 = 0
totala7 = 0
totala8 = 0
totala9 = 0
totala10 = 0
'Response.Write("totala2")
'Response.Write("totala3")
'Response.Write("totala4")
%>


Message #2 by "Ken Schaefer" <ken@a...> on Tue, 24 Sep 2002 11:19:17 +1000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "damian lynch" <damian.lynch@o...>
Subject: [access_asp] Microsoft VBScript runtime error '800a0006'


: What does this overflow error mean?
:
: Thanking in advance.
:
: Heres the code.
:
<snipped for your viewing sanity>
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

...and pray tell us, *where* in the 262 lines of code that you posted does
this error occur?

Also, this looks like a database that is screaming out for some
normalisation. You could probably do all of the stuff below with just 1 SQL
statement, and 1 recordset object if you stored the UserID and QuestionID
and Result in a table, eg you had:

Users table
Questions table
UsersQuestions table (UserID, QuestionID, Result)

Then you could do:

SELECT
    QuestionID,
    COUNT(QuestionID)
FROM
    UsersQuestions
WHERE
    QuestionID IN (1,2,3,4,5,6,7)
GROUP BY
    QuestionID

Lastly, don't use LIKE %% if you don't have to. You seem to be testing for
equality. If so, use =. LIKE %% might be more convenient, but you lose all
benefits of any indexes (and other optimisations that the database might be
able to do). Instead you end up doing a tablescan to find matching results.

Considering that this is Access(!), you need to work in all the
optimisations you can into your SQL, your VBScript and the database itself,
otherwise it's going to fall over very quickly.

Cheers
Ken



  Return to Index