ASP

1.      Page asp simple.
2.      Page asp flux.
3.      Page ajax entre asp et html
4.      Accès à la base en asp avec e-spirit.

1. Page asp simple.

<!-- #INCLUDE FILE="ConnectDB.asp" -->
<%
	dim appel
	dim oRstStatut
	set oRstStatut=Server.CreateObject("ADODB.Recordset")	
	vQuery = "select * FROM Programme"
	set oRstStatut = ExecuteSQL(vQuery)
	appel="<table border=1>" & vbCrLf
	appel=appel & "<tr><td>id_programme</td><td>id_region</td><td>Libelle</td><td>Adresse</td><td>CodePostal</td><td>Ville</td><td>Livraison</td></tr>"
	while not oRstStatut.EOF
		appel=appel & "<tr><td>" & oRstStatut("id_programme") & "</td><td>" & oRstStatut("id_region") & "</td><td>" & oRstStatut("Libelle") & "</td><td>" & oRstStatut("Adresse") & "</td><td>" & oRstStatut("CodePostal") & "</td><td>" & oRstStatut("Ville") & "</td><td>" & oRstStatut("Livraison") & oRstStatut("NomContact") & oRstStatut("EmailContact") & "</td></tr>" & vbCrLf
		oRstStatut.MoveNext 
	Wend 
	appel=appel & "</table>" & vbCrLf
%>
<!doctype html>
<html>
	<head>
		<title>Programme</title>
		<meta charset='iso-8859-1'>
	</head>
	<body>
		<h2>Liste des programmes</h2>
		<%=appel%>
	</body>
</html>

2. Page asp flux.

<!-- #INCLUDE FILE="ConnectDB.asp" -->
<%
	dim appel
	dim oRstStatut
	set oRstStatut=Server.CreateObject("ADODB.Recordset")	
	vQuery = "select * FROM Programme"
	set oRstStatut = ExecuteSQL(vQuery)
	appel="<table border=1>" & vbCrLf
	appel=appel & "<tr><td>id_programme</td><td>id_region</td><td>Libelle</td><td>Adresse</td><td>CodePostal</td><td>Ville</td><td>Livraison</td></tr>"
	while not oRstStatut.EOF
		appel=appel & "<tr><td>" & oRstStatut("id_programme") & "</td><td>" & oRstStatut("id_region") & "</td><td>" & oRstStatut("Libelle") & "</td><td>" & oRstStatut("Adresse") & "</td><td>" & oRstStatut("CodePostal") & "</td><td>" & oRstStatut("Ville") & "</td><td>" & oRstStatut("Livraison") & oRstStatut("NomContact") & oRstStatut("EmailContact") & "</td></tr>" & vbCrLf
		oRstStatut.MoveNext 
	Wend 
	appel=appel & "</table>" & vbCrLf
	response.write (appel)
%>

3. Page ajax entre asp et html

<html>
	<head>
		<title>Statut</title>
		<meta charset="utf-8" />
		<script>
			function charger(){
				console.log ('hello');
				var xmlhttp = new XMLHttpRequest();
				xmlhttp.onreadystatechange = function() {
					if (this.readyState == 4 && this.status == 200) {
						document.getElementById("resultat").innerHTML = this.responseText;
					}
				}
				var url = "http://localhost/appasp/marieProgramme_flux.asp";
				console.log (url);
				xmlhttp.open("GET", url, true);
				xmlhttp.overrideMimeType('text/xml; charset=iso-8859-1');
				xmlhttp.send();
			}
		</script>
	</head>
	<body onload="charger();">
		<p id="resultat">
			coucou
		</p>
	</body>
</html>

4. Accès à la base en asp avec e-spirit.

<!-- #INCLUDE FILE="ConnectDB.asp" -->
<%
varColorA = "#DF013E"
tabBannierHaute(0) = " bgcolor=""#CC0000"""
%>
<!doctype html>
<html>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
	<head>
	<!-- #INCLUDE FILE="includes/BanniereHaute.asp" -->			
	</head>
	<link rel="stylesheet" type="text/css" href="css/style.css">	
	<body>	
		<%
		dim oRstStatut
		set oRstStatut=Server.CreateObject("ADODB.Recordset")	
		vQuery = "select * FROM _SCI"
		set oRstStatut = ExecuteSQL(vQuery)
		while not oRstStatut.EOF
			Response.Write(oRstStatut("NomSCI") & "<br/>")
			oRstStatut.MoveNext 
		Wend 
		%>
	</body>
</html>