Creer un fichier .txt ou .xml en asp bd acces

cs_rachidma Messages postés 4 Date d'inscription dimanche 26 mars 2006 Statut Membre Dernière intervention 31 mai 2006 - 29 mai 2006 à 02:55
cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 - 31 mai 2006 à 19:03
bonjour,
   svp ,je me suis bloqué,aidé moi,j ai besoin d un code asp qui sert a ceeer un fichier .txt ou .xml pour  mettre le journal des actions faite ds mon projet.merci bc

Rodick

7 réponses

cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 16
29 mai 2006 à 19:18
V'là :

Option

Explicit

FunctionCreateFile
(FileName
AsString,ContentAsString
)

 DimFSOAsObject

 SetFSO
= Server
.CreateObject
( "Scripting.FileSystemObject"
)

 DimTextFileAsTextStream
 

 SetTextFile
=FSO
.CreateTextFile
(FileName
,True
)
 TextFile
.Write
Content
 
 TextFile.Close

 SetTextFile
=
Nothing

 SetFSO
=
Nothing

End
Function

Guillaume
0
cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 16
29 mai 2006 à 19:20
Oups ! Petite erreur ...

OptionExplicit

Function
CreateFile(FileNameAsString,ContentAsString)
 Dim
FSO
 Set
FSO= Server .CreateObject( "Scripting.FileSystemObject" )
 Dim
TextFile
 
 Set
TextFile =FSO.CreateTextFile(FileName,True)
 TextFile.WriteContent
 
 TextFile.Close
 Set
TextFile= Nothing

 Set
FSO =Nothing

End
Function
0
cs_rachidma Messages postés 4 Date d'inscription dimanche 26 mars 2006 Statut Membre Dernière intervention 31 mai 2006
29 mai 2006 à 21:48
merci bc pour ce code,cool.
0
cs_rachidma Messages postés 4 Date d'inscription dimanche 26 mars 2006 Statut Membre Dernière intervention 31 mai 2006
29 mai 2006 à 23:10
svp,quel evenement je peux faire ce code,dans une  botton!! ou koi et merci.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 16
30 mai 2006 à 18:45
bah ca dépend de ce que tu veux faire ....
0
cs_rachidma Messages postés 4 Date d'inscription dimanche 26 mars 2006 Statut Membre Dernière intervention 31 mai 2006
31 mai 2006 à 14:33
bon voila ce ke je veux faire:
-apres avoir creer le fichier , je veux enregistrer tout les action ,en fete un fichier historique ou journal .
Rodick
0
cs_ghuysmans99 Messages postés 3982 Date d'inscription jeudi 14 juillet 2005 Statut Membre Dernière intervention 30 juin 2013 16
31 mai 2006 à 19:03
v'là :

dans le fichier "Logs.cls.asp" :

<%

'########################################################

'############################ Logs Lib ##################

'########################################################

ClassLogs

Option
Explicit

DimTextFile

DimCurrentFile

FunctionCreateLogs
(FileName
)

DimFSO

SetFSO
= Server
.CreateObject
( "Scripting.FileSystemObject"
)

SetTextFile
=FSO
.CreateTextFile
(FileName
,True
)
CurrentFile
= FileName

SetFSO
=
Nothing

End
Function

FunctionClearLogs
()

DimFSO

SetFSO
= Server
.CreateObject
( "Scripting.FileSystemObject"
)

FSO
.DeleteFile
CurrentFile
CurrentFile =""

SetFSO
=
Nothing

End
Function

FunctionAddLog
(Text
)

IfCurrentFile
= ""
Then
Err
.Raise
"1001","AddLog(Text)"
,"Un fichier doit être ouvert !"

Else
TextFile
.Write
Text
End
If

End
Function

FunctionCloseLogs
()
TextFile
.Close

CurrentFile = ""

End
Function

EndClass

%>

et tu l'appelle comme ça :

<!-- #include file = "./Logs.cls.asp" -->

<%

DimMesLogs

SetMesLogs
= New Logs

'Là tu mes ton code

SetMesLogs
=
Nothing

%>
0
Rejoignez-nous