Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Problema in scrittura file txt con FSO

Reply
 
Old 12-12-2008   #1 (permalink)
yappappeo


 
 

Problema in scrittura file txt con FSO

Ciao a tutti,
ho un problema nella scrittura di file txt all'interno di una
directory. Ho cercato altrove nel forum ma non ho trovato cose simili.
Ho il seguente codice:

Dim tipo, titolo, testo, data, ora
tipo = Trim(Request.Form("tipo"))
titolo = Trim(Request.Form("titolo"))
testo = Trim(Request.Form("testo"))
data = Trim(Request.Form("data"))

Dim nomefile
nomefile = Year(date()) & Month(date()) & Day(date()) & Hour(time()) &
Minute(time()) & Second(time()) & ".txt"

Dim ApriFile, FSO, Path
Path = "C:/Documents and Settings/dir/news/" & nomefile
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set ApriFile = FSO.CreateTextFile(Path)
ApriFile.Writeline tipo
ApriFile.Writeline "<dt>" & titolo
ApriFileA.Writeline " <span>" & data & "</span></dt>"
ApriFile.Write "<dd>" & testo & "</dd>
ApriFile.Close
Set ApriFile = Nothing
Set FSO = Nothing

Ora, a video non mi appare alcun errore e il file viene creato, ma
risulta essere senza i contenuti passati dalla form. Il file viene
nominato correttamente, ma al suo interno appaiono solo i tag che gli
passo direttamente nei comandi 'Write'.
La form che invia i file dovrebbe funzionare (è collegata anche a un
db al quale passa altri dati...)

Non capisco se sto sbagliano io oppure se il mio sistema ha un
problema nella gestione del File System Object...

Ho fatto altre prove, ad esempio:

<%
Dim fsoMyFile
Dim tsTextStream

Set fsoMyFile = CreateObject("Scripting.FileSystemObject")
Set tsTextStream = fsoMyFile.CreateTextFile(Server.MapPath
("miofile.txt"), True)
%>

In questo caso dovrebbe crearmi un file txt vuoto chiamato "miofile",
giusto? Ebbene, non succede niente e non mi da nessun errore...

....help...

My System SpecsSystem Spec
Old 12-12-2008   #2 (permalink)
Pegasus \(MVP\)


 
 

Re: Problema in scrittura file txt con FSO


<yappappeo@xxxxxx> wrote in message
news:613fdad6-88c7-4016-a782-a422f58ca739@xxxxxx
Ciao a tutti,
ho un problema nella scrittura di file txt all'interno di una
directory. Ho cercato altrove nel forum ma non ho trovato cose simili.
Ho il seguente codice:

Dim tipo, titolo, testo, data, ora
tipo = Trim(Request.Form("tipo"))
titolo = Trim(Request.Form("titolo"))
testo = Trim(Request.Form("testo"))
data = Trim(Request.Form("data"))

Dim nomefile
nomefile = Year(date()) & Month(date()) & Day(date()) & Hour(time()) &
Minute(time()) & Second(time()) & ".txt"

Dim ApriFile, FSO, Path
Path = "C:/Documents and Settings/dir/news/" & nomefile
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set ApriFile = FSO.CreateTextFile(Path)
ApriFile.Writeline tipo
ApriFile.Writeline "<dt>" & titolo
ApriFileA.Writeline " <span>" & data & "</span></dt>"
ApriFile.Write "<dd>" & testo & "</dd>
ApriFile.Close
Set ApriFile = Nothing
Set FSO = Nothing

Ora, a video non mi appare alcun errore e il file viene creato, ma
risulta essere senza i contenuti passati dalla form. Il file viene
nominato correttamente, ma al suo interno appaiono solo i tag che gli
passo direttamente nei comandi 'Write'.
La form che invia i file dovrebbe funzionare (è collegata anche a un
db al quale passa altri dati...)

Non capisco se sto sbagliano io oppure se il mio sistema ha un
problema nella gestione del File System Object...

Ho fatto altre prove, ad esempio:

<%
Dim fsoMyFile
Dim tsTextStream

Set fsoMyFile = CreateObject("Scripting.FileSystemObject")
Set tsTextStream = fsoMyFile.CreateTextFile(Server.MapPath
("miofile.txt"), True)
%>

In questo caso dovrebbe crearmi un file txt vuoto chiamato "miofile",
giusto? Ebbene, non succede niente e non mi da nessun errore...

....help...

================

I recommend that you post your question in an Italian newsgroup or else post
it in an English translation.


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Problema con contatti MSN. Live Messenger
Soluzione problema Vista mail
problema Vista mail
Scrittura chiavi di registro Vista General
Problema Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46