Striped Fish2 Posted August 22, 2011 Share Posted August 22, 2011 Okay I am trying to write functions to reduce the amount of connections to the database and make my code simpler and shorter. So I have created a file that will be included that has some of the functions I have been testing out.This is the error I get ADODB.Recordset800a0bb9Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another./DragonCraft/Includes/combat_functions.asp 15And here is the code:<%'Functions for combat written by Glorfindel on August 21, 2011Function openconnection(database)set conn=Server.CreateObject("ADODB.Connection")conn.Provider="Microsoft.Jet.OLEDB.4.0"conn.Open "" & database & ""End FunctionFunction MonsterHP(ID)openconnection("C:\Databases\DragonKwest.mdb")set rs = Server.CreateObject("ADODB.recordset")sql="SELECT Health From Monsters WHERE [ID]=" & ID & ""rs.open sql, conndo until rs.EOFfor each x in rs.FieldsMonsterHP = x.value nextrs.MoveNextlooprs.closeconn.closeEnd Functionresponse.write MonsterHP(1)%> Link to comment Share on other sites More sharing options...
justsomeguy Posted August 22, 2011 Share Posted August 22, 2011 Apparently with VBscript, if you dim the variable outside of a function then it becomes global. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.