Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'rspoint'
/wargames/includes/include.asp, line 3815
| SitePoint Sponsor |
Microsoft VBScript runtime error '800a01f4'
Variable is undefined: 'rspoint'
/wargames/includes/include.asp, line 3815

Sorry
Response.Write "RSPoints = " & VarType(rspoints("ranking")) & ", RSPlayer = " & varType(rsplayer("ranking")) & vbCrLf
Line 3809 is 'rspoints.addnew'.RSPoints = 14, RSPlayer = 14 RSPoints = 14, RSPlayer = 14 RSPoints = 14, RSPlayer = 14 RSPoints = 14, RSPlayer = 14
Microsoft JET Database Engine error "80040e07'
Data type mismatch in criteria expression.
/wargames/includes/include.asp, line 3809

So if I'm counting right, it looks like it doesn't like the 0 in this recordset...very odd. The CDbl should have accounted for that.
You could try changing the sum in the SQL statement to CAST(SUM(ranking) AS FLOAT) AS RANKING
gameid = 13 teamname = >]VF[< clan teamid = 471 teamtag = >]VF[< ranking = 0
Ok wait, what do I have to change now? Do you mean this statement:
What do I change there exactly?Code:SQL = "select sum(ranking) as ranking , teamname, teamtag, teamid from war_teamwarrankings where warid in (select warid from war_wars where gameid=" & igameid & ") group by teamname, teamid, teamtag"

Change the sum(ranking) as ranking to CAST(SUM(ranking) AS FLOAT) AS RANKING.
Okay the line looks like this now:
Result:Code:SQL = "select CAST(SUM(ranking) AS FLOAT) AS RANKING , teamname, teamtag, teamid from war_teamwarrankings where warid in (select warid from war_wars where gameid=" & igameid & ") group by teamname, teamid, teamtag"
This is line 3805:Error "80004005'
/wargames/includes/include.asp, line 3805
Code:rsPlayer.open SQL, dbconnection, adopenforwardonly, adlockreadonly

Crap. It's access. Let me think about how to do it in access.....
@r937 , I'm about at the end of my ideas here. Is there something blatantly obvious I'm missing here?
I wonder if the problem is that although the value for rsPoints("ranking") looks like a number, it isn't. Maybe it needs to be cast as a double:
Or if we can't get it to be treated as a number you could try changing the field type in your access database to a text field and see if that removes the error.Code:rsPoints("ranking") = Cdbl(rsplayer("ranking")) ' Casts as a double
Edit: Oops, you've been busy... I didn't see that your already onto a second page today and have already looked at casting the value.
Andrew Wasson | www.lunadesign.org
Principal / Internet Development
No Andrew, yours didn't work as well.
But I think I just figured it out: I just opened the table 'war_teamgamerankings' and changed the Data Type of 'ranking' from 'Decimal' to 'Double'. The error is gone now!! Thanks guys for all the hints and your time!
Though I still have another error like this on my site. Here is the code:
Error message in browser:Code:' Get a list of players who have participated in this war rsmatches.open "select distinct playerid, playername, teamid, teamname, teamtag " & _ "from war_rcmatchreports, war_rcmatches where war_rcmatchreports.matchid=war_rcmatches.matchid and warid=" & iWarID, _ dbConnection, adOpenStatic, adLockReadOnly sDebugResults = sDebugResults & crlf & crlf & "-------------------------" & CRLF & "Initializing player list for war " & iWarID & CRLF & "-------------------------" & CRLF rsplayer.open "war_rcstats", dbConnection, adOpenStatic, adLockOptimistic, adCmdTable do until rsMatches.EOF rsPlayer.AddNew rsPlayer("warid") = iWarid rsPlayer("gameid") = iGameID rsPlayer("username") = rsmatches("playername") rsPlayer("memberid") = rsmatches("playerid") rsPlayer("teamname") = rsmatches("teamname") rsPlayer("teamid") = rsmatches("teamid") rsPlayer("teamtag") = rsmatches("teamtag") rsPlayer("gamesplayed") = 0 rsplayer("gameshosted") = 0 rsplayer("gameswon") = 0 rsplayer("gameslost") = 0 rsplayer("victoryrt") = 0 rsplayer("kills") = 0 rsplayer("deaths") =0 rsplayer("attritionrt") = 0 rsplayer("appg") = 0 rsplayer("upp") = 0 rsplayer("hrp") = 0 rsplayer("skills") = 0 rsplayer("ranking") = 0 rsplayer.update rsMatches.movenext loop rsmatches.close rsPlayer.Close
Line 11772: rsplayer.updateMicrosoft JET Database Engine Fehler "80040e07'
Data type mismatch in criteria expression.
/wargames/includes/include.asp, line 11772
I used the same method you guys tought me and found this line as the cause of the error:
When commented out, error message dissappeares.Code:rsPlayer("warid") = iWarid
I already tried the same like before to fix this. I opened the table 'war_rcstats' and changed the data type of the 'warid' field to all the other options and tested it. Regardless what data type I use in there, the error still shows up.
Any idea?

iWarID is probably empty or non-numeric.
How can I fix that?
I'd comment out the update and response.write all of the iWarID fields to the screen. You can ignore the other fields for now because that one seems to be the problem.
Andrew Wasson | www.lunadesign.org
Principal / Internet Development
How can I do that? I tried something but it won't work.... the browser loads forever and the 'w3wp.exe' runs with 30% CPU usage and more and more RAM usage.... I can only stop this process by killing it.
Can you give me the code I need, please?
Try something like this:
Code:icounter = 0 ' I added a counter so we can see which entry is causing the trouble... Maybe... do until rsMatches.EOF rsPlayer.AddNew rsPlayer("warid") = iWarid rsPlayer("gameid") = iGameID rsPlayer("username") = rsmatches("playername") rsPlayer("memberid") = rsmatches("playerid") rsPlayer("teamname") = rsmatches("teamname") rsPlayer("teamid") = rsmatches("teamid") rsPlayer("teamtag") = rsmatches("teamtag") rsPlayer("gamesplayed") = 0 rsplayer("gameshosted") = 0 rsplayer("gameswon") = 0 rsplayer("gameslost") = 0 rsplayer("victoryrt") = 0 rsplayer("kills") = 0 rsplayer("deaths") =0 rsplayer("attritionrt") = 0 rsplayer("appg") = 0 rsplayer("upp") = 0 rsplayer("hrp") = 0 rsplayer("skills") = 0 rsplayer("ranking") = 0 ' rsplayer.update ' COMMENTED OUT THE DATABASE UPDATE TO PREVENT THE ERROR Response.Write "<p>iWarid during loop number "& icounter &" = " & iWarid & "</p>" icounter = icounter + 1 ' Increment the icounter rsMatches.movenext loop
Andrew Wasson | www.lunadesign.org
Principal / Internet Development
Thank you! This is the result:
Line 11784: rsPlayer.CloseCode:Calculating Battle Statistics. Please wait. iWarid during loop number 0 = 269 iWarid during loop number 1 = 269 iWarid during loop number 2 = 269 iWarid during loop number 3 = 269 iWarid during loop number 4 = 269 iWarid during loop number 5 = 269 iWarid during loop number 6 = 269 iWarid during loop number 7 = 269 iWarid during loop number 8 = 269 iWarid during loop number 9 = 269 iWarid during loop number 10 = 269 iWarid during loop number 11 = 269 iWarid during loop number 12 = 269 iWarid during loop number 13 = 269 iWarid during loop number 14 = 269 iWarid during loop number 15 = 269 iWarid during loop number 16 = 269 iWarid during loop number 17 = 269 iWarid during loop number 18 = 269 iWarid during loop number 19 = 269 iWarid during loop number 20 = 269 iWarid during loop number 21 = 269 iWarid during loop number 22 = 269 iWarid during loop number 23 = 269 iWarid during loop number 24 = 269 iWarid during loop number 25 = 269 iWarid during loop number 26 = 269 iWarid during loop number 27 = 269 iWarid during loop number 28 = 269 iWarid during loop number 29 = 269 iWarid during loop number 30 = 269 iWarid during loop number 31 = 269 iWarid during loop number 32 = 269 iWarid during loop number 33 = 269 iWarid during loop number 34 = 269 iWarid during loop number 35 = 269 iWarid during loop number 36 = 269 iWarid during loop number 37 = 269 iWarid during loop number 38 = 269 iWarid during loop number 39 = 269 iWarid during loop number 40 = 269 iWarid during loop number 41 = 269 iWarid during loop number 42 = 269 iWarid during loop number 43 = 269 iWarid during loop number 44 = 269 iWarid during loop number 45 = 269 iWarid during loop number 46 = 269 iWarid during loop number 47 = 269 iWarid during loop number 48 = 269 iWarid during loop number 49 = 269 iWarid during loop number 50 = 269 iWarid during loop number 51 = 269 iWarid during loop number 52 = 269 iWarid during loop number 53 = 269 iWarid during loop number 54 = 269 iWarid during loop number 55 = 269 iWarid during loop number 56 = 269 iWarid during loop number 57 = 269 iWarid during loop number 58 = 269 iWarid during loop number 59 = 269 iWarid during loop number 60 = 269 iWarid during loop number 61 = 269 iWarid during loop number 62 = 269 iWarid during loop number 63 = 269 iWarid during loop number 64 = 269 iWarid during loop number 65 = 269 iWarid during loop number 66 = 269 iWarid during loop number 67 = 269 iWarid during loop number 68 = 269 iWarid during loop number 69 = 269 iWarid during loop number 70 = 269 iWarid during loop number 71 = 269 iWarid during loop number 72 = 269 iWarid during loop number 73 = 269 iWarid during loop number 74 = 269 iWarid during loop number 75 = 269 iWarid during loop number 76 = 269 iWarid during loop number 77 = 269 iWarid during loop number 78 = 269 iWarid during loop number 79 = 269 iWarid during loop number 80 = 269 iWarid during loop number 81 = 269 iWarid during loop number 82 = 269 iWarid during loop number 83 = 269 iWarid during loop number 84 = 269 iWarid during loop number 85 = 269 iWarid during loop number 86 = 269 iWarid during loop number 87 = 269 iWarid during loop number 88 = 269 iWarid during loop number 89 = 269 iWarid during loop number 90 = 269 iWarid during loop number 91 = 269 iWarid during loop number 92 = 269 iWarid during loop number 93 = 269 iWarid during loop number 94 = 269 iWarid during loop number 95 = 269 iWarid during loop number 96 = 269 iWarid during loop number 97 = 269 iWarid during loop number 98 = 269 iWarid during loop number 99 = 269 iWarid during loop number 100 = 269 iWarid during loop number 101 = 269 iWarid during loop number 102 = 269 iWarid during loop number 103 = 269 iWarid during loop number 104 = 269 iWarid during loop number 105 = 269 iWarid during loop number 106 = 269 iWarid during loop number 107 = 269 iWarid during loop number 108 = 269 iWarid during loop number 109 = 269 iWarid during loop number 110 = 269 iWarid during loop number 111 = 269 iWarid during loop number 112 = 269 iWarid during loop number 113 = 269 ADODB.Recordset error '800a0c93' Operation is not allowed in this context. /wargames/includes/include.asp, line 11784
Sorry about that... I wasn't thinking. Of course iWarid is a static number and we didn't need to put it through the loop. This leads me to think we're (I'm) on the wrong track.
* In the Access Database war_rcstats, the column for warid is an integer right?
Scrap my code that looped out the iWarid variable but do comment out the rsPlayer update and we'll have a look at what the gameid is
It should be an integer or double or whatever matches the type in the database for that column.Code:Response.Write "<p>The iGameID = "&iGameID&"</p>" do until rsMatches.EOF rsPlayer.AddNew rsPlayer("warid") = iWarid rsPlayer("gameid") = iGameID rsPlayer("username") = rsmatches("playername") rsPlayer("memberid") = rsmatches("playerid") rsPlayer("teamname") = rsmatches("teamname") rsPlayer("teamid") = rsmatches("teamid") rsPlayer("teamtag") = rsmatches("teamtag") rsPlayer("gamesplayed") = 0 rsplayer("gameshosted") = 0 rsplayer("gameswon") = 0 rsplayer("gameslost") = 0 rsplayer("victoryrt") = 0 rsplayer("kills") = 0 rsplayer("deaths") =0 rsplayer("attritionrt") = 0 rsplayer("appg") = 0 rsplayer("upp") = 0 rsplayer("hrp") = 0 rsplayer("skills") = 0 rsplayer("ranking") = 0 ' rsplayer.update ' COMMENTED OUT THE DATABASE UPDATE TO PREVENT THE ERROR rsMatches.movenext loop
If that's fine, go through the rest of the variables and make sure they are correct: rsmatches("playername"), rsmatches("playerid"), rsmatches("teamname"), rsmatches("teamid"), rsmatches("teamtag")
Edit: You'll probably still get that error on closing but that's probably because I've interrupted the database transaction mid stream or something but we're troubleshooting so it's to be expected.
Andrew Wasson | www.lunadesign.org
Principal / Internet Development
This is the result of your new code:
Yes, 'warid' is set on 'Long Integer'.Code:Calculating Battle Statistics. Please wait. The iGameID = 13 ADODB.Recordset error '800a0c93' Operation is not allowed in this context. /wargames/includes/include.asp, line 11782
Yea all the other columns seem to be fine. Only 'warid' is causing troubles.
Ok, so if you comment out the line with rsPlayer("warid") = iWarid the script runs without an error right?
So that means that the error is that the database isn't happy when you try to insert a value into that column. What are the full specs on that data column? Is it set to have any other settings like autonumber (autoincrement), indexed, or anything else that would prevent us from putting in a number?
You can try casting the number as an integer but I don't think that's the problem. rsPlayer("warid") = cInt(iWarid)
Andrew Wasson | www.lunadesign.org
Principal / Internet Development
Yes, only the line rsPlayer("warid") = iWarid causes the error.
These are the settings of 'warid' on 'war_rcstats':
access.png
By the way: rsPlayer("warid") = cInt(iWarid) didn't work.
Well, I'm at a whits end. I just reviewed my references on ADO.VBS and I can't see anything glaring.
As a last ditch effort lets see if you can insert a static value (number) into that table. I've commented out the offending line and replaced it with a line that inserts the number 13.
Code:do until rsMatches.EOF rsPlayer.AddNew ' rsPlayer("warid") = iWarid ' Commented out for testing rsPlayer("warid") = 13 ' Added to insert 13 into the warid column. rsPlayer("gameid") = iGameID rsPlayer("username") = rsmatches("playername") rsPlayer("memberid") = rsmatches("playerid") rsPlayer("teamname") = rsmatches("teamname") rsPlayer("teamid") = rsmatches("teamid") rsPlayer("teamtag") = rsmatches("teamtag") rsPlayer("gamesplayed") = 0 rsplayer("gameshosted") = 0 rsplayer("gameswon") = 0 rsplayer("gameslost") = 0 rsplayer("victoryrt") = 0 rsplayer("kills") = 0 rsplayer("deaths") =0 rsplayer("attritionrt") = 0 rsplayer("appg") = 0 rsplayer("upp") = 0 rsplayer("hrp") = 0 rsplayer("skills") = 0 rsplayer("ranking") = 0 rsplayer.update rsMatches.movenext loop
Andrew Wasson | www.lunadesign.org
Principal / Internet Development
Hmm I checked the table: it inserted a '13' for every 'warid'. But I still get an error:
This is line 11785:Code:ADODB.Recordset error '800a0e79' Operation is not allowed when the object is open. /wargames/includes/include.asp, line 11785
Code:rsMatches.open SQL, dbConnection, adOpenStatic, adLockReadOnly
Ok so why is it that you can't enter '13' when it is the variable iWarid but you can if it's just a number. I'm just grasping at straws now but tryThe error you received indicates that rsMatches was already open and was never closed in an earlier line of code.Code:rsPlayer("warid") = abs(iWarid)
You should close all open records as soon as possible (right after you've used it) and then set the recordset to = nothing. So somewhere after rsMatches was used you want to have
Code:rsMatches.close set rsMatches = nothing
Andrew Wasson | www.lunadesign.org
Principal / Internet Development





What if you move the rsPlayer("warid") = iWarid line to just before rsPlayer.update?
It shouldn't matter but it looks like all other options have been exhausted.
For some reason I keep getting this now:
This is the code:Code:Calculating Battle Statistics. Please wait. Microsoft Cursor Engine error '80040e38' Row cannot be located for updating. Some values may have been changed since it was last read. /wargames/includes/include.asp, line 12123
And once again, the trouble-making line is 'rsPlayer.Update'.Code:' Calculate preliminary rankings rsplayer.open "select * from war_rcstats where gamesplayed >=" & iMinGamesReqd & " and warid=" & iWarID, dbconnection, adopenstatic, adlockoptimistic do until(rsPlayer.EOF) iGamesRT = rsplayer("gamesplayed").value iVictoryRT = rsplayer("victoryrt").value iAPPG = rsplayer("appg").value iTotUPPRT = rsplayer("upp").value iTotAENPTS = rsplayer("aenpts").value ' if rsplayer("gameshosted") <> 0 and iMinGamesHosted <> 0 then ' rsplayer("gameshostedranking") = cdbl(20)*(iMinGamesHosted / rsplayer("gameshosted")) ' else ' rsplayer("gameshostedranking") = cdbl(20)*((20 - rsplayer("gameshosted"))/20) ' end if if cdbl(iMaxGamesRT) <> cdbl(iMinGamesRT) then rsplayer("gamesplayedranking").value = ((9.00/(cdbl(iMaxGamesRT)-cdbl(iMinGamesRT)))*(cdbl(iGamesRT)-cdbl(iMinGamesRT)))+1 else rsplayer("gamesplayedranking").value = 10.00 end if if cdbl(iMaxVictoryRT) <> cdbl(iMinVictoryRT) then rsplayer("victoryrtranking") = ((24.00/(cdbl(iMaxVictoryRt)-cdbl(iMinVictoryRt)))*(cdbl(iVictoryRT)-cdbl(iMinVictoryRt)))+1 else rsplayer("victoryrtranking") = 25.00 end if if cdbl(iMaxAENPTS) <> cdbl(iMinAENPTS) then rsplayer("aenptsranking") = (24.00-((24.00/(cdbl(iMaxAENPTS)-cdbl(iMinAENPTS)))*(cdbl(iTotAENPTS)-cdbl(iMinAENPTS))))+1 else rsplayer("aenptsranking") = 25.00 end if if cdbl(iMaxAPPG) <> cdbl(iMinAPPG) then rsplayer("appgranking") = ((24.00/(cdbl(iMaxAPPG)-cdbl(iMinAPPG)))*(cdbl(iAPPG)-cdbl(iMinAPPG)))+1 else rsplayer("appgranking") = 25.00 end if if cdbl(iMaxUPP) <> cdbl(iMinUPP) then rsplayer("uppranking") = ((14.00/(cdbl(iMaxUPP)-cdbl(iMinUPP)))*(cdbl(iTotUPPRT)-cdbl(iMinUPP)))+1 else rsplayer("uppranking") = 15.00 end if ' if rsplayer("gameshosted") <> 0 and iMinGamesHosted <> 0 then rsplayer("ranking") = cdbl(rsplayer("gamesplayedranking")) + _ cdbl(rsplayer("victoryrtranking")) + _ cdbl(rsplayer("appgranking")) + _ cdbl(rsplayer("aenptsranking")) + _ cdbl(rsplayer("uppranking")) ' else ' rsplayer("ranking") = cdbl(20)*((20 - rsplayer("gameshosted"))/20) + _ ' cdbl(20)*(rsplayer("gamesplayed")/iMaxGamesPlayed) + _ ' cdbl(20)*(cdbl(iVictoryRT)/cdbl(iMaxVictoryRT)) + _ ' cdbl(20)*(cdbl(iAttritionRT)/cdbl(iMaxAttritionRt)) + _ ' cdbl(20)*(rsPlayer("upp").value/iMaxUPP) ' end if rsPlayer.Update rsplayer.movenext loop rsPlayer.Close
@awasson
Yea I didn't close rsMatches because I accidently deleted two lines. Thanks for your hint!
Bookmarks