20. maj 2002 - 14:07Der er
3 kommentarer og 1 løsning
Skrive / læse i fil
Jeg har skrevet dette script som skulle lægge 1 til en variabel i en txt fil, men den kommer med denne fejl:
Der opstod en Microsoft VBScript-kørselsfejl (0x800A0036) Filtilstanden er ugyldig
----------------------------- if (Vwhy = "contact") then set fs2 = createobject("scripting.filesystemobject") set file = fs2.opentextfile(server.mappath("contact.dat")) Contactcount = cint(file.readline) Contactcount = Contactcount + 1 file.writeline(Contactcount) file.close set fs2 = nothing end if
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
du skal bruge opentextfile(server.mappath("contact.dat"), 2, False)
Sub OpenTextFileTest Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim fso, f Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True) f.Write "Hello world!" f.Close End Sub
Required. String expression that identifies the file to open.
iomode
Optional. Indicates input/output mode. Can be one of three constants: ForReading, ForWriting, or ForAppending.
create
Optional. Boolean value that indicates whether a new file can be created if the specified filename doesn't exist. The value is True if a new file is created; False if it isn't created. The default is False.
format
Optional. One of three Tristate values used to indicate the format of the opened file. If omitted, the file is opened as ASCII.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.