Functions in ASP 2.0

Results 1 to 2 of 2

Thread: Functions in ASP 2.0

  1. #1
    Join Date
    Dec 1969

    Default Functions in ASP 2.0

    Hi,<BR><BR>I have a few questions about ASP functions. <BR><BR>1) Can functions share connection objects? If I define and open a connection object in the calling ASP page, can my function use the same object. I add the function the to page via an Include statement.<BR><BR>2) Sometimes, it seems like my function just doesn&#039t fire. I know the variables I pass to it are there but it just gets ignored. I close all the connections and record sets after I use it. Is there some sort of buffering,etc. I need to declare in order to reset it. Does this have something to do with the variable passed back?<BR><BR>thanks,<BR><BR>Steve<BR>steve@designm<BR><BR>Here is the function. I declare objconn in the calling page:<BR><BR>&#060;%<BR><BR>Function GetID(strNumber, strPassword)<BR>DIM ObjRSGETID, strcPersonSQL<BR> SET ObjRSGETID = Server.CreateObject("ADODB.Recordset")<BR> strcPersonSQL = "SELECT iPeopleID FROM People WHERE RTRIM(cNumber) =&#039" & _<BR> StrNumber+ "&#039 AND RTRIM(cPassword) =&#039" & strPassword+"&#039;"<BR> ObjRSGetID.Open strcPersonSQL, objconn, adOpenForwardOnly, adLockOptimistic, adCmdText<BR> <BR> LogonID = ObjRSGETID("iPeopleID")<BR> ObjRSGETID.close<BR> SET ObjRSGETID = NOTHING<BR>END FUNCTION<BR><BR>%&#062;

  2. #2
    MG Guest

    Default RE: Functions in ASP 2.0

    Yes, you can use share connection objects. Just declare them at the top of the page and they will be availiable to all.<BR><BR>The functionis not getting ignored. You need to add one line to it just before the end function like this<BR><BR>GetID = LogonID<BR>End Function<BR><BR>you can do something like this to call it<BR>dim logID<BR>logID = GetID(Number,Password)<BR>response.write logID<BR><BR>that should do it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts