<%@ Language=VBScript %>
<%
' === création table M si inexistante =============================================
Set ConBDD = CreateObject("ADODB.Connection")
sDB = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\www\chemin_physique_vers_votre_base"
conBDD.Open sDB
dim rs2:set rs2=createobject("ADODB.recordset")
nom_table = DatePart("m",Date()) &"_"& DatePart("yyyy",Date())
flag_er=True
rs2.open conBDD.OpenSchema (20)
do while not rs2.eof
if rs2(3)= "TABLE" then
if rs2(2)= nom_table then
flag_er=False: exit do
end if
end if
rs2.movenext
loop
rs2.close
if flag_er then
conBDD.execute "SELECT * INTO " & nom_table & " from VIDE;" ' table vide avec les champs prédéfinis
rs2.open "select * from STATS order by id_stat", conBDD,1,2
rs2.addnew
rs2("stat_table") = nom_table
rs2.update
rs2.close
end if
' fermeture connexion
set rs2=nothing: set rs=nothing
conBDD.Close
'---- Détermine si l'année est bisextiles ou pas ----
Function BisexYear(WhichYear)
If WhichYear/4=Int(WhichYear/4) Then
BisexYear=True
Else
BisexYear=False
End If
End Function
'---- Le nombre de jours dans un mois ----
Function xDaysIn(WhichDate)
Dim xdays
xDays=Array("","31","","31","30","31","30","31","31","30","31","30","31")
If Month(WhichDate)=2 Then
If BisexYear(Year(WhichDate))=True Then
xDaysIn=29
Else
xDaysIn=28
End If
Else
xDaysIn=xDays(Month(WhichDate))
End If
End Function
%>