p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: locking/unlocking textfiles


Message #1 by <johncogan@e...> on Thu, 3 Aug 2000 10:44:27 +0100
Hi

Was wondering if objFile.Lock/Unlock is allowed as in the
Application("MyVariable").Lock/Unlock ?

Plz see code below.

FilePath = Server.MapPath("/db/paintpeople.txt")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(FilePath,8,FALSE)

FilePath2 = Server.MapPath("/db/paintdetails.txt")
Set objFSO2 = Server.CreateObject("Scripting.FileSystemObject")
Set objFile2 = objFSO2.OpenTextFile(FilePath2,8,FALSE)

objFile.Lock
objFile2.Lock

objFile.WriteLine callsign & "<BR>"

'--------------------------------------------- Second data
store ---------------
'objFile.WriteLine "TEST TEST TEST"
'temp = firstname & vbCrLf & lastname & vbCrLf & emailaddress & vbCrLf &
icqnumber & vbCrLf & callsign & vbCrLf & myage
objFile2.WriteLine firstname
objFile2.WriteLine lastname
objFile2.WriteLine emailaddress
objFile2.WriteLine icqnumber
objFile2.WriteLine callsign
objFile2.WriteLine myage
objFile2.WriteLine "-----------------"
objFile.Close

objFile.Unlock
objFile2.Unlock

Set objFSO = nothing
Set objFile = nothing


  Return to Index