Striped Fish2 1 Posted August 22, 2011 Report 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)%> Quote Link to post Share on other sites
justsomeguy 1,135 Posted August 22, 2011 Report Share Posted August 22, 2011 Apparently with VBscript, if you dim the variable outside of a function then it becomes global. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.