‘La Stringa di connessione al Database StrConnessione = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&path_db Dim Conn Function OpenConnection() ‘Apro la connesione al database Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open StrConnessione End Function Function CloseConnection() ‘ Chiudo la connessione al database Conn.Close Set Conn = Nothing End Function Function RipristinaCaratteri(str) str = replace(str,"[**","<") str = replace(str,"**]",">") str = replace(str,"&eacute;","é") str = replace(str,"&egrave;","è") str = replace(str,"&agrave;","à") str = replace(str,"&ograve;","ò") str = replace(str,"&igrave;","ì") RipristinaCaratteri = str End Function Function SostituisciCaratteri(str) str = replace(str,"&","&") str = replace(str,"è","&eacute;") str = replace(str,"é","&egrave;") str = replace(str,"à","&agrave;") str = replace(str,"ò","&ograve;") str = replace(str,"ì","&igrave;") str = replace(str,"<","[**") str = replace(str,">","**]") SostituisciCaratteri = str End function function PrintTab(str,NumTab) ‘ Questa funzione l’ho utilizzata per formattare l’xml PrintTab = true if len(str)>0 then strTmp = "" if NumTab>0 then for i = 1 to NumTab strTmp = strTmp & VbTab Next End if response.write strTmp & str&VbNewLine End if End Function Sub ScriviSuFile(Contenuto,path_file) ‘ Una classica funzione che scrive su file il contenuto di una variabile Set FileObject=CreateObject("Scripting.FileSystemObject") Set FileText=FileObject.CreateTextFile(path_file,true) FileText.WriteLine(Contenuto) FileText.Close End Sub Function InsertSQL(nomeTabella,NomeId,Campi,valori) InsertSQL = 0 sql ="Insert into "& nomeTabella &"("&Campi &") values("&valori&")" Set rs = Conn.Execute(sql) InsertSQL = GetMaxFromTable(nomeTabella,NomeId) End Function Function UpdateSQL(NomeTabella,CampiUpload,CampiWhere) sql ="update "& Nometabella &" set "& campiUpload &" where "& CampiWhere Set rs = Conn.Execute(sql) UpdateSQL = 0 End Function Function DeleteSQL(NomeTabella,CampiWhere) sql ="delete from "& Nometabella &" where "& CampiWhere Set rs = Conn.Execute(sql) DeleteSQL = 0 End Function Function GetMaxFromTable(NomeTabella,NomeId) GetMaxFromTable = 0 sql = "select max("& NomeId &") as NumeroRecord from "& nometabella Set rs = Conn.Execute(sql) if not rs.Eof then GetMaxFromTable = rs("NumeroRecord") End if End Function Function GetHttpVariable(nomeCampo,options) ' options - 1 - post e get ' options - 2 - post ' options - 3 - get GetHttpVariable = Empty If len(nomecampo)>0 Then Select Case options case 1 if len(request.Form(nomecampo))>0 then GetHttpVariable = Trim(request.Form(nomecampo)) Elseif len(request(nomecampo))>0 then GetHttpVariable = Trim(request(nomecampo)) End if case 2 if len(request.Form(nomecampo))>0 then GetHttpVariable = Trim(request.Form(nomecampo)) End if case 3 if len(request(nomecampo))>0 then GetHttpVariable = Trim(request(nomecampo)) End if End Select End if End Function