using ASP object and methods inside function

Results 1 to 2 of 2

Thread: using ASP object and methods inside function

  1. #1
    Join Date
    Dec 1969

    Default using ASP object and methods inside function

    hi folks,<BR><BR>is it possible to use methods of the FileSystemObject inside a function? i can indeed instantiate the the TextStreamObject from FSO, but can not use the foo.ReadLine method of that TextStream object. the browser is giving me a Server.CreateObject &#039;can not create&#039; error. here is my code:<BR>-----------------------------------<BR>-----------------------------------<BR>&#060;%<BR>&#039; FUNCTION: rejectDuplicate()<BR>&#039; INPUT: xLoc (location of text file)<BR>&#039; OUTPUT: xRejDup ("true" if match found in textfile [bad])<BR>function xRejDup(xLoc) <BR> dim xFileSys, xTextStream, xLineScan, xCounter<BR> Set xFileSys = Server.CreateObject ("Scripting.FileSystemObject")<BR> Set xTextStream = xFileSys.OpenTextFile(xLoc, 1)<BR> xCounter = 0<BR> Do Until xCounter = 6<BR> xLineScan = xTextStream.ReadLine<BR> If xLineScan = slot(xCounter) Then<BR> xCounter = xCounter + 1<BR> Else<BR> xCounter = 0<BR> End If<BR> Loop<BR> If xCounter = 6 Then<BR> xRejDup = "true"<BR> Else<BR> xRejDup = "false" <BR> End If<BR>end function<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: using ASP object and methods inside function

    Alright, what line is causing the error? We can&#039;t debug very well with out the full error message and line numbers. <BR>Everything looks alright except, what is the &#039;slot&#039; method you are calling? And you&#039;re not setting the final value of your function. Indenting helps readability quite a lot too. <BR>

Posting Permissions

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