Quick way to check?

Results 1 to 3 of 3

Thread: Quick way to check?

  1. #1
    Melina Guest

    Default Quick way to check?

    I have a text file that has a list of valid clients:<BR><BR>Client1<BR>Client2<BR>Client3<BR>e tc...<BR><BR>Is there a way I can check that text file do see if a certain client exists? I am sorry to ask such a basic question.

  2. #2
    Join Date
    Dec 1969

    Default RE: Quick way to check?

    If it&#039s not too big a file, you could do this...<BR>dim fs, ts, readstring<BR>Set fs = Server.CreateObject ("Scripting.FileSystemObject")<BR>Set ts = fs.OpenTextFile (filename, forReading, False)<BR>readstring = ts.ReadAll<BR>If (instr (1, readstring, searchval) &#062; 0) then<BR>&#039Found it<BR>else<BR>&#039No match<BR>end if<BR><BR>If you have a large input file (&#062; 5 - 10K, we&#039ll say) performance will suffer and you&#039ll want to set up a loop to read each line individually. The general process is the same.<BR><BR>hth, Derek

  3. #3
    Join Date
    Dec 1969

    Default RE: Quick way to check?

    Using the FileSystemObject is a good way, as you were told.<BR><BR>*IF* the text file is regular in nature. That is, if it *looks* like a spreadsheet but just happens to be in a text file, then you can treat it as a database with the Microsoft "text file driver" in ODBC.<BR><BR>Not recommending this for this simple case, but keep it in mind.<BR><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