<% Set conn = Server.CreateObject("ADODB.Connection") conn.open chaine_de_connexion_ou_DSN
Set ObjTable = conn.OpenSchema(20) do while not ObjTable.eof if ObjTable("table_type")="TABLE" then response.write ObjTable("table_name")&" <br>" end if ObjTable.moveNext loop
ObjTable.close set ObjTable = nothing conn.close set conn = nothing %>
Simple arborescence d'un répertoire
<%
Parent = Server.MapPath(".") ' ou "C:\ton_rep" 'ouverture du systeme de fichiers
Set Fso = Server.createObject("Scripting.FileSystemObject") 'création de l'objet répertoire
Set Rep = Fso.GetFolder(Parent)
response.write "Répertoires :<BR>"
For Each RepFiles In Rep.SubFolders
response.write RepFiles.Name & "<BR>"
Next
response.write "<HR>Fichiers :<BR>"
For Each RepFiles In Rep.Files
response.write RepFiles.Name & "<BR>"
Next
%>
Récuperer votre adresse IP externe
Vous développez en local et vous désirez savoir votre adresse IP de connexion internet (Adresse Externe) voici un simple script :
<%
addr = "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("SCRIPT_NAME")
if request("ip") <> "" then
response.write request("ip")
else
response.redirect "http://www.madbison.fr.fm/getip.asp?addr=" & addr
end if
%>
Lecture d'un fichier INI (Configuration)
<%
Function GetIni(File, Section, Key)
GetIni = "Error"
On Error Resume Next
Set FSO = CreateObject("Scripting.FileSystemObject")
Set F = FSO.OpenTextFile(File, 1)
C = F.ReadAll
F.Close
TC = Split(C, vbCrLf)
Section = "[" & Section & "]"
For a = 0 To UBound(TC) - 1
If TC(a) = Section Then
If Err.Number <> 0 Then Exit Function
a = a + 1
Do While Left(TC(a),1) <> "["
If Err.Number <> 0 Then Exit Function
K = Mid(TC(a), 1, InStr(1, TC(a), "=") - 1)
If K = Key Then
GetIni = Mid(TC(a), InStr(1, TC(a), "=") + 1)
Exit Function
End If
a = a + 1
Loop
End If
Next
End Function
%>
Appel :
<%
Response.Write GetIni("C:\Essai.ini", "Clé1", "Valeur2")
%>