

ou via
Programmation (163 topics, 2371 messages) Dernier message par Babaorum, le 30/09 à 09:51:29 |
|
| Centaurus inscrit le 06/03/2003 |
Salut,
Je dois modifier un formulaire en asp qui est lié à une base de données access. Le problème, c'est que je n'ai jamais touché ni à asp, ni à access
Le but de cette modification est de faire en sorte que chaque nouvel élément ajouté au formulaire se place en tête de liste (tri par date, la plus récente en premier) Voici le code de la page où le formulaire s'affiche avec les résultats : <%@ Language=VBScript %> <% Option Explicit %> <!--#include file="dbconnect.asp"-
<html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> </head> <body> <h1 align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"><img border="0" src="../images/offres_fr.gif"></h1> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"></p> <% Dim objRS Set objRS = Server.CreateObject ("ADODB.Recordset") objRS.Open "offrefr", objConn,3,3 Do While Not objRS.EOF %> <div align="center"> <center> <table border="1" width="500"> <tr> <td width="34%" bgcolor="#00CCFF"> <p align="center" style="margin-top: 1; margin-bottom: 1"><b><font face="Arial" size="2">Réf. </font><font face="Arial" size="2"><%Response.Write objRS("ref")%> </font></b></td> <td width="66%" bgcolor="#00FFCC" colspan="2"> <p align="center" style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b><% Response.Write objRS("domaine") %></b></font></td> </tr> <tr> <td width="100%" bgcolor="#00FFCC" colspan="3"> <p align="center" style="margin-top: 1; margin-bottom: 1"><b><font face="Arial" size="2"><%Response.Write objRS("poste") %></font></b></td> </tr> <tr> <td width="25%" align="center" bgcolor="#00CCFF"> <p style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b>Lieu :</b></font></p> </td> <td width="25%" align="center" bgcolor="#00CCFF"> <p style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b>Date :</b></font></p> </td> <td width="25%" align="center" bgcolor="#00CCFF"> <p style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b>Durée :</b></font></p> </td> </tr> <tr> <td width="25%" align="center"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("lieu") %></font></td> <td width="25%" align="center"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("date") %></font></td> <td width="25%" align="center"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("durée") %></font></td> </tr> <tr> <td width="75%" colspan="3"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("détail") %></font></td> </tr> <tr> <td width="75%" colspan="3"> <p align="center" style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="1" color="#FF0000">Si cette offre vous intéresse, notez la référence et cliquez sur le bouton "Postuler"</font></p> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"><a href="cv_fr.htm"><img border="0" src="../images/WB01488_.gif"></a></p> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"><font size="1" face="Arial" color="#FF0000"><b>Postuler</b></font></td> </tr> </table> </center> </div> <% Response.Write "<p><hr></p>" objRS.MoveNext Loop objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing %> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"> <a href="emploi_fr.htm" target="_self"><img border="0" src="../images/WB01624_.gif" align="top"></a> <a href="emploi_fr.htm" target="_self"><font face="Arial" size="2">Page précédente</font></a></p> </body> </html> Est-ce que l'un de vous saurait me donner un coup de main ? Merci |
|
| Centaurus inscrit le 06/03/2003 |
Pour moi au premier coup d'oeil, je penserais que c'est cette partie qu'il faut modifier mais ... ???
<% Dim objRS Set objRS = Server.CreateObject ("ADODB.Recordset") objRS.Open "offrefr", objConn,3,3 Do While Not objRS.EOF %> |
|
| ronsard59 inscrit le 02/03/2003 |
ben dite donc ! |
|
| vertigo_76 inscrit le 05/03/2003 |
Vu la tete du code ca ressemble a du dreamwaver!
![]() |
|
Cleo![]() inscrit le 07/03/2003 |
apparemment c'est du front page (voir balise meta) ![]() |
|
| Centaurus inscrit le 06/03/2003 |
Oui apparemment ça a été fait sous front page (mais c'est pas moi qui l'ai fait) et j'ai aucune idée de la façon de m'y prendre |
|
| Centaurus inscrit le 06/03/2003 |
Bon, la page avec le formulaire est celle-ci : saisie.asp
<% Option Explicit %> <html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title></title> </head> <!--#include file="dbconnect.asp"-
<body bgcolor="#000090" link="#FFFFFF" vlink="#FFFF00"> <p align="center"><img border="0" src="../images/logo3.gif" width="114" height="80"></p> <p align="center"><font face="Arial" size="4" color="#FFFFFF"><b><i><u>Saisie d'une nouvelle Offre</u></i></b></font></p> <% Dim objRS, booleenUtilisat, strNomUtilisat, strMotdePasse strNomUtilisat=Request.Form("login") strMotdePasse=Request.Form("pass") If ((strNomUtilisat = "") OR (strMotdePasse = "")) Then objConn.Close Set objRS = Nothing Response.Write "<A HREF='ident.htm'>" Response.Write "Vous devez remplir tous les champs !" Response.Write "</A>" Response.end End if Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open "users", objConn,3,3 booleenUtilisat=false Do While Not (objRS.EOF OR booleenUtilisat) If (StrComp(objRS("login"), strNomUtilisat, _ vbTextCompare) = 0) Then booleenUtilisat = True Else objRS.MoveNext End If Loop If Not booleenUtilisat Then objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing Response.Write "<A HREF='ident.htm'>" Response.Write "identifiant non valide !" Response.Write "</A>" Response.end End if If not (StrComp(objRS("passe"), strMotdePasse, _ vbTextCompare) = 0) Then objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing Response.Write "<A HREF='ident.htm'>" Response.Write "Mot de passe non valide !" Response.Write "</A>" Response.end End if %> <form method="POST" action="record.asp" name="saisie"> <div align="center"> <center> <table border="1" width="620"> <tr> <td width="34%" bgcolor="#00CCFF"> <p align="center"><b><font face="Arial" size="2">Réf. <input type="text" name="frm_ref" size="9"></font></b></td> <td width="66%" bgcolor="#00FFCC" colspan="2"> <p align="center"><b><font face="Arial" size="2">Domaine : </font></b><input type="text" name="frm_domaine" size="45"></td> </tr> <tr> <td width="100%" bgcolor="#00FFCC" colspan="3"> <p align="center"><font face="Arial" size="2"><b>Poste : <input type="text" name="frm_poste" size="78"></b></font></td> </tr> <tr> <td width="25%" align="center" bgcolor="#00CCFF"><font face="Arial" size="2"><b>Lieu :</b></font></td> <td width="25%" align="center" bgcolor="#00CCFF"><font face="Arial" size="2"><b>Date :</b></font></td> <td width="25%" align="center" bgcolor="#00CCFF"><font face="Arial" size="2"><b>Durée :</b></font></td> </tr> <tr> <td width="25%" align="center"><font face="Arial" size="2"><input type="text" name="frm_lieu" size="20"></font></td> <td width="25%" align="center"><font face="Arial" size="2"><input type="text" name="frm_date" size="20"></font></td> <td width="25%" align="center"><font face="Arial" size="2"><input type="text" name="frm_duree" size="20"></font></td> </tr> <tr> <td width="75%" colspan="3"><font face="Arial" size="2"><textarea rows="5" name="frm_detail" cols="73"></textarea></font></td> </tr> </table> </center> </div> <input type="HIDDEN" value="<%= strNomUtilisat%>" name="login"><input type="HIDDEN" value="<%= strMotdePasse%>" name="pass"> <p align="center"><input type="submit" value="Envoyer"><input type="reset" value="Rétablir"></p> </form> <form method="POST" action="gestion.asp" name="retour"> <input type="HIDDEN" value="<%= strNomUtilisat%>" name="login"><input type="HIDDEN" value="<%= strMotdePasse%>" name="pass"> <p align="center"><input type="submit" value="Retour au gestionnaire" name="B1"></p> </form> </body> </html> |
|
| Centaurus inscrit le 06/03/2003 |
Et la page appelée est celle-là : record.asp
<% Option Explicit %> <html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>enregistrement offre</title> </head> <!--#include file="dbconnect.asp"-
<body bgcolor="#000090" link="#FFFFFF" vlink="#FFFF00"> <p align="center"><img border="0" src="../images/logo3.gif" width="114" height="80"></p> <p align="center"><font face="Arial" size="4" color="#FFFFFF"><b><i><u>L'offre a été enregistrée avec succès</u></i></b></font></p> <% Dim objRS, booleenUtilisat, booleenExisteDeja, strNomUtilisat, strMotdePasse strNomUtilisat=Request.Form("login") strMotdePasse=Request.Form("pass") If ((strNomUtilisat = "") OR (strMotdePasse = "")) Then objConn.Close Set objRS = Nothing Response.Write "<A HREF='ident.htm'>" Response.Write "Vous devez saisir le nom d'utilisateur et le mot de passe !" Response.Write "</A>" Response.end End if Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open "users", objConn,3,3 booleenUtilisat=false Do While Not (objRS.EOF OR booleenUtilisat) If (StrComp(objRS("login"), strNomUtilisat, _ vbTextCompare) = 0) Then booleenUtilisat = True Else objRS.MoveNext End If Loop If Not booleenUtilisat Then objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing Response.Write "<A HREF='ident.htm'>" Response.Write "identifiant non valide !" Response.Write "</A>" Response.end End if If not (StrComp(objRS("passe"), strMotdePasse, _ vbTextCompare) = 0) Then objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing Response.Write "<A HREF='ident.htm'>" Response.Write "Mot de passe non valide !" Response.Write "</A>" Response.end End if If ((Request.Form("frm_ref") = "") OR (Request.Form("frm_date") = "") _ OR (Request.Form("frm_domaine") = "") OR (Request.Form("frm_poste") = "") _ OR (Request.Form("frm_lieu") = "") OR (Request.Form("frm_duree") = "") _ OR (Request.Form("frm_detail") = "")) Then Response.Write "<a href='javascript:history.go(-1)'>" Response.Write "Vous devez saisir tous les champs !" Response.Write "</A>" Response.end Else booleenExisteDeja = False Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open "offrefr", objConn,3,3 Do While Not (objRS.EOF OR booleenExisteDeja) If (StrComp(objRS("ref"), Request.Form("frm_ref"), _ vbTextCompare) = 0) Then Response.Write "<a href='javascript:history.go(-1)'>" Response.Write "Cette référence existe déjà !" Response.Write "</A>" booleenExisteDeja = True Response.end End If objRS.MoveNext Loop If Not booleenExisteDeja Then objRS.AddNew objRS("ref") = Request.Form("frm_ref") objRS("date") = Request.Form("frm_date") objRS("domaine") = Request.Form("frm_domaine") objRS("poste") = Request.Form("frm_poste") objRS("lieu") = Request.Form("frm_lieu") objRS("durée") = Request.Form("frm_duree") objRS("détail") = Request.Form("frm_detail") objRS.Update End If objRS.Close Set objRS = Nothing End If objConn.Close Set objConn = Nothing %> <form method="POST" action="gestion.asp" name="retour"> <input type="HIDDEN" value="<%= strNomUtilisat%>" name="login"><input type="HIDDEN" value="<%= strMotdePasse%>" name="pass"> <p align="center"><input type="submit" value="Retour au gestionnaire" name="B1"></p> </form> </body> </html> Message modéré le 01/09 à 12:35:02 par Centaurus. |
|
| Babaorum adjoint
L'homme n'est qu'une machine inscrit le 01/03/2003 |
Sérieux Cento lâche l'ASP, c casse-c... comme c pas permis et vraiment pas très rapide
A moins que tu n'y sois obligé ? |
|
| Centaurus inscrit le 06/03/2003 |
Bah oui, on m'a demandé de modifier un formulaire en asp. Donc c obligé
Mais apparemment, le code que j'ai ne serait peut-être pas le bon, donc va falloir que je récupère celui qui est sur leur serveur qui lui doit fonctionner. ça sera peut-être un peu plus facile |
|
| Centaurus inscrit le 06/03/2003 |
Bon le code est le même.
Ce code là sera peut-être plus simple à tripatouiller. C'est peut-être la partie en bleu qui est à modifier en y incluant un requête SQL ??!! <%@ Language=VBScript %> <% Option Explicit %> <!--#include file="dbconnect.asp"-
<html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> </head> <body> <h1 align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"><img border="0" src="../images/offres_fr.gif"></h1> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"></p> <% Dim objRS Set objRS = Server.CreateObject ("ADODB.Recordset") objRS.Open "offrefr", objConn,3,3 Do While Not objRS.EOF %> <div align="center"> <center> <table border="1" width="500"> <tr> <td width="34%" bgcolor="#00CCFF"> <p align="center" style="margin-top: 1; margin-bottom: 1"><b><font face="Arial" size="2">Réf. </font><font face="Arial" size="2"><%Response.Write objRS("ref")%> </font></b></td> <td width="66%" bgcolor="#00FFCC" colspan="2"> <p align="center" style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b><% Response.Write objRS("domaine") %></b></font></td> </tr> <tr> <td width="100%" bgcolor="#00FFCC" colspan="3"> <p align="center" style="margin-top: 1; margin-bottom: 1"><b><font face="Arial" size="2"><%Response.Write objRS("poste") %></font></b></td> </tr> <tr> <td width="25%" align="center" bgcolor="#00CCFF"> <p style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b>Lieu :</b></font></p> </td> <td width="25%" align="center" bgcolor="#00CCFF"> <p style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b>Date :</b></font></p> </td> <td width="25%" align="center" bgcolor="#00CCFF"> <p style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b>Durée :</b></font></p> </td> </tr> <tr> <td width="25%" align="center"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("lieu") %></font></td> <td width="25%" align="center"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("date") %></font></td> <td width="25%" align="center"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("durée") %></font></td> </tr> <tr> <td width="75%" colspan="3"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("détail") %></font></td> </tr> <tr> <td width="75%" colspan="3"> <p align="center" style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="1" color="#FF0000">Si cette offre vous intéresse, notez la référence et cliquez sur le bouton "Postuler"</font></p> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"><a href="cv_fr.htm"><img border="0" src="../images/wb01488_.gif"></a></p> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"><font size="1" face="Arial" color="#FF0000"><b>Postuler</b></font></td> </tr> </table> </center> </div> <% Response.Write "<p><hr></p>" objRS.MoveNext Loop objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing %> <p></p> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"> <a href="emploi_fr.htm" target="_self"><img border="0" src="../images/wb01624_.gif" align="top"></a> <a href="emploi_fr.htm" target="_self"><font face="Arial" size="2">Page précédente</font></a></p> </body> </html> Message modéré le 10/09 à 15:20:29 par Centaurus. |
|
| Centaurus inscrit le 06/03/2003 |
Pour ceux que ça intéresse , la résolution de mon problème :
html> <head> <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> </head> <body> <h1 align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"><img border="0" src="../images/offres_fr.gif"></h1> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"></p> <% DSN_BASE = "DBQ=" & Server.Mappath("../../database/db1.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}" %> <% Set objConn=Server.CreateObject("ADODB.Connection") objConn.open DSN_BASE %> <% Dim objRS Set objRS = Server.CreateObject ("ADODB.Recordset") objRS.Open "SELECT offrefr.IDoffre, offrefr.ref, offrefr.date, offrefr.domaine, offrefr.poste, offrefr.lieu, offrefr.durée, offrefr.détail FROM offrefr AS offrefr ORDER BY offrefr.IDoffre DESC", objConn,3,3 Do While Not objRS.EOF %> <div align="center"> <center> <table border="1" width="500"> <tr> <td width="34%" bgcolor="#00CCFF"> <p align="center" style="margin-top: 1; margin-bottom: 1"><b><font face="Arial" size="2">Réf. </font><font face="Arial" size="2"><%Response.Write objRS("ref")%> </font></b></td> <td width="66%" bgcolor="#00FFCC" colspan="2"> <p align="center" style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b><% Response.Write objRS("domaine") %></b></font></td> </tr> <tr> <td width="100%" bgcolor="#00FFCC" colspan="3"> <p align="center" style="margin-top: 1; margin-bottom: 1"><b><font face="Arial" size="2"><%Response.Write objRS("poste") %></font></b></td> </tr> <tr> <td width="25%" align="center" bgcolor="#00CCFF"> <p style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b>Lieu :</b></font></p> </td> <td width="25%" align="center" bgcolor="#00CCFF"> <p style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b>Date :</b></font></p> </td> <td width="25%" align="center" bgcolor="#00CCFF"> <p style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="2"><b>Durée :</b></font></p> </td> </tr> <tr> <td width="25%" align="center"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("lieu") %></font></td> <td width="25%" align="center"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("date") %></font></td> <td width="25%" align="center"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("durée") %></font></td> </tr> <tr> <td width="75%" colspan="3"><font face="Arial" size="2"> <p style="margin-top: 1; margin-bottom: 1"><%Response.Write objRS("détail") %></font></td> </tr> <tr> <td width="75%" colspan="3"> <p align="center" style="margin-top: 1; margin-bottom: 1"><font face="Arial" size="1" color="#FF0000">Si cette offre vous intéresse, notez la référence et cliquez sur le bouton "Postuler"</font></p> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"><a href="cv_fr.htm"><img border="0" src="../images/WB01488_.gif"></a></p> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"><font size="1" face="Arial" color="#FF0000"><b>Postuler</b></font></td> </tr> </table> </center> </div> <% Response.Write "<p><hr></p>" objRS.MoveNext Loop objRS.Close Set objRS = Nothing objConn.Close Set objConn = Nothing %> <p align="center" style="word-spacing: 0; line-height: 100%; text-indent: 0; margin-left: 0; margin-right: 0; margin-top: 1; margin-bottom: 1"> <a href="emploi_fr.htm" target="_self"><img border="0" src="../images/WB01624_.gif" align="top"></a> <a href="emploi_fr.htm" target="_self"><font face="Arial" size="2">Page précédente</font></a></p> </body> </html> |
|
| Babaorum adjoint
L'homme n'est qu'une machine inscrit le 01/03/2003 |
A tes souhaits
Non non je te rassure, on comprend tout de même ![]() |
|
Vous ne pouvez pas ajouter de messages.
Forum gratuit proposé par
v 2.7 alpha 1
-
Un service
-
Page générée en 0,026 secondes le 08/09 à 13:02:13.