Citation :
<OBJECT RUNAT="SERVER" SCOPE="APPLICATION" ID="objTabMarque" PROGID="Scripting.Dictionary">
</OBJECT>
<OBJECT RUNAT="SERVER" SCOPE="APPLICATION" ID="objTabMoCidMarque" PROGID="Scripting.Dictionary">
</OBJECT>
<OBJECT RUNAT="SERVER" SCOPE="APPLICATION" ID="objTabMoCLibelleMoC" PROGID="Scripting.Dictionary">
</OBJECT>
<script language="JScript" runat="Server">
function Application_OnStart ()
{
// Ouvrir une connexion à la base
var DBConn;
DBConn = Server.CreateObject("ADODB.Connection" );
DBConn.ConnectionTimeout = 15;
DBConn.CommandTimeout = 30;
DBConn.CursorLocation = 3;
DBConn.Open("DSN=MonDSN;UID=MonUID;PASSWORD=MonPass" );
// Requètes
var sqlMarque, sqlMoC;
sqlMarque = "SELECT Ma.idMarque, Ma.LibelleMarque ";
sqlMarque+= "FROM Marque Ma, ModeleCourt MoC, Modele Mo, Type Ty, Vehicule Ve ";
sqlMarque+= "WHERE Ve.CapID = Ty.CapID AND Ty.idModele = Mo.idModele ";
sqlMarque+= "AND Mo.idModeleCourt = MoC.idModeleCourt AND MoC.idMarque = Ma.idMarque ";
sqlMarque+= "ORDER BY LibelleMarque";
sqlMoC = "SELECT MoC.idModeleCourt, MoC.LibelleModeleCourt, MoC.idMarque ";
sqlMoC+= "FROM ModeleCourt MoC, Modele Mo, Type Ty, Vehicule Ve ";
sqlMoC+= "WHERE Ve.CapID = Ty.CapID AND Ty.idModele = Mo.idModele AND Mo.idModeleCourt = MoC.idModeleCourt";
// RecordSet
var idMarque, idModeleCourt, libelleMarque, libelleModeleCourt;
rsMarque = Server.CreateObject("ADODB.Recordset" );
rsMarque.Open (sqlMarque, DBConn, 3, 3);
while (!rsMarque.eof)
{
idMarque = parseInt (rsMarque ("idMarque" ));
libelleMarque = new String (rsMarque ("libelleMarque" ));
objTabMarque.Add (idMarque, libelleMarque);
rsMarque.moveNext ();
}
rsMarque.close ();
rsModeleCourt = Server.CreateObject("ADODB.Recordset" );
rsModeleCourt.Open (sqlMoC, DBConn, 3, 3);
while (!rsModeleCourt.eof)
{
idModeleCourt = parseInt (rsModeleCourt ("idModeleCourt" ));
idMarque = parseInt (rsModeleCourt ("idMarque" ));
libelleModeleCourt = new String (rsModeleCourt ("libelleModeleCourt" ));
objTabMoCidMarque.Add (idModeleCourt, idMarque); objTabMoCLibelleMoC.Add (idModeleCourt, libelleModeleCourt); rsModeleCourt.moveNext ();
}
rsModeleCourt.close ();
}
</script>
|