IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP Discussion :

impossible d'afficher des parametres avec un insert into


Sujet :

ASP

  1. #1
    Membre à l'essai
    Inscrit en
    Janvier 2004
    Messages
    24
    Détails du profil
    Informations forums :
    Inscription : Janvier 2004
    Messages : 24
    Points : 12
    Points
    12
    Par défaut impossible d'afficher des parametres avec un insert into
    Bonjour à toutes et à tous,

    Je développe encore et encore un panier virtuel, j'aimerai bien devenir un jedi de l'asp mais je suis encore qu'un petit apprenti ...
    donc voici mon problème qui pour moi est un gro problème mais pour d'autres jedi de l'asp est un petit problem...

    Alors voila en gros dans mon panier virtuel, j'ai un catalogue ou je selectionne des revues et j'aimerai attribuer ces revues a des personnes donc j'ai un champ texte dans mon catalogue pour que l'utilisateur puisse inscrire de le nom de la personne qui achete la revue.

    Voici la première partie du code qui est la page passerunecommande.asp tout du moins l'entete, connexion base requetes.....:

    La partie catalogue et la partie panier sont sur la meme page...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
     
    <%	Response.Expires = -1
        Response.AddHeader "Pragma", "no-cache"
        Response.AddHeader "cache-control", "no-store"
     
    ' connexion base et requetes	
    set MaConn=Server.CreateObject("ADODB.Connection") 
    	set rstAff2=Server.CreateObject("ADODB.Recordset")
    	MaConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("gestion.mdb") & ";Persist Security Info=False"
    	affichageClient="SELECT civilite.civilAbreg, client.* FROM client, civilite WHERE client.idCivil=civilite.idCivil AND client.idClient=" & Request("idClient")
    	set rstAff=MaConn.Execute (affichageClient)
     
    'partie recherche	
    if not trim(Request("rechercheRef")) = "" then 
    	reqRef = " AND produit.prodLib like '" & trim(Request("rechercheRef")) & "%' "
    		else
    	reqRef = ""
    	end if
     
    	if not trim(Request("rechercheCateg")) = "" then 
    	reqCateg =  " AND produit.idCateg=" & trim(Request("rechercheCateg"))
    	else
    	reqCateg = ""
    	end if
     
    	affichageProduit="SELECT produit.idProd, produit.prodRef, produit.prodLib, produit.prodDescr, produit.prodPu, categorie.catLib From categorie, produit Where categorie.idCateg = produit.idCateg " & reqRef & reqCateg  & order
    	rstAff2.Open affichageProduit,MaConn,1,1
    	if not rstAff2.EOF then
    		rstAff2.PageSize=6
    		rstAff2.AbsolutePage=Request("Page")
    	end if
    	if Request("idCommande")="" then
    		reqNbCommande="SELECT MAX(commandeTemp.idComm)AS NumCommande from commandeTemp"
    		set rstNbComm=MaConn.Execute(reqNbCommande)
    		if IsNull(rstNbComm("NumCommande")) then
    			numCommande=1
    		else
    			numCommande=rstNbComm("NumCommande")+0
    		end if
    	else 
    	numCommande = Request("idCommande")
    	end if
    	affichageProduitCommande="SELECT produit.idProd, produit.prodRef, produit.prodLib, produit.prodPu, commanderTemp.comQt, commanderTemp.Nomabo, [produit.prodPu]*[commanderTemp.comQt] AS Total FROM produit, commanderTemp WHERE commanderTemp.idProd = produit.idProd AND commanderTemp.idComm = " & numCommande
    	set rstAff3=MaConn.Execute(affichageProduitCommande)
    	TotalCommande="SELECT Sum([comQt]*[prodPu]) AS TotalComm from commanderTemp, produit Where commanderTemp.idProd = produit.idProd AND commanderTemp.idcomm = " & numCommande & " GROUP BY commanderTemp.idComm;"
    	set rstTot=MaConn.Execute(TotalCommande)
    	affichageCateg="SELECT categorie.catLib, categorie.idCateg FROM categorie"
    	set rstAffCateg=MaConn.Execute(affichageCateg)%>
     
    <html>
    <head>
    	<title>commande</title>
    		<LINK REL="stylesheet" TYPE="text/css" HREF="style.css">
    		<link rel="stylesheet" media="print" href="impression.css">
     
    	<script language="JavaScript">
    	var quantit = new Number(0);
    	var nomabon = new String("");
    	function Ajout(IdProd,prodLib)	{
    		quantit = eval('document.ListeProduit.comQt'+IdProd+'.value');
    		nomabon = eval('document.ListeProduit.Nomabo'+IdProd+'.value');
    		if (isNaN(quantit)) {
    			alert("Quantité incorrecte");
    							}
    		else {
    			if (quantit >= 1)	{
    				window.open('ajoutProdComm.asp?idProd='+IdProd+'&comQt='+parseInt(quantit)+'&Nomabo='+nomabon+'&idComm=<%=numCommande%>&idClient=<%=Request("idClient")%>&Page=<%=Request("Page")%>&rechercheRef=<%=Request("rechercheRef")%>&rechercheCateg=<%=Request("rechercheCateg")%>&Tri=<%=Request("Tri")%>','_self','');
    								}
    			else{
    				alert("Quantité incorecte");
    				}
    							}
    									}
    		function quote(s)	{
    		sss=new String();
    		for(i=0;i<s.length;i++)	{
    								if(s.substring(i,i+1)!="'")
    									{sss=sss+s.substring(i,i+1);														}
    								else
    									{sss=sss+"'"+s.substring(i,i+1);}
    								}
    		return(sss);
    							}
    	<body background="images/menubackgroundcont.gif" onload="DivLoad.style.visibility='hidden';MettreFocus();">
     
     
    'partie catalogue
    <tr class="seeme">
    						<th bgcolor="#B0F5FF" width="7%" class="seeme" style="border-top-style: solid; border-top-width: 1px">
    							<% If AscRef = true then %>
    								<a href="passerCommande.asp?Tri=2&Page=<%=Request("Page")%>&idClient=<%=Request("idClient")%>&idCommande=<%=Request("idCommande")%>&rechercheRef=<%=Request("rechercheRef")%>&rechercheCateg=<%=Request("rechercheCateg")%>">Ref</a>
    							<% Else  %>
    								<a href="passerCommande.asp?Tri=1&Page=<%=Request("Page")%>&idClient=<%=Request("idClient")%>&idCommande=<%=Request("idCommande")%>&rechercheRef=<%=Request("rechercheRef")%>&rechercheCateg=<%=Request("rechercheCateg")%>">Ref</a>
    							<% End If %>
    						</th>
    						<th bgcolor="#B0F5FF" width="48%" class="seeme" style="border-top-style: solid; border-top-width: 1px">
    							<% If AscLib = true then %>
    								<a href="passerCommande.asp?Tri=4&Page=<%=Request("Page")%>&idClient=<%=Request("idClient")%>&idCommande=<%=Request("idCommande")%>&rechercheRef=<%=Request("rechercheRef")%>&rechercheCateg=<%=Request("rechercheCateg")%>">Libellé</a>
    							<% Else  %>
    								<a href="passerCommande.asp?Tri=3&Page=<%=Request("Page")%>&idClient=<%=Request("idClient")%>&idCommande=<%=Request("idCommande")%>&rechercheRef=<%=Request("rechercheRef")%>&rechercheCateg=<%=Request("rechercheCateg")%>">Libellé</a>
    							<% End If %>
    						</th>
    						<th bgcolor="#B0F5FF" width="7%" class="seeme" style="border-top-style: solid; border-top-width: 1px">
    							<% If AscPri = true then %>
    								<a href="passerCommande.asp?Tri=6&Page=<%=Request("Page")%>&idClient=<%=Request("idClient")%>&idCommande=<%=Request("idCommande")%>&rechercheRef=<%=Request("rechercheRef")%>&rechercheCateg=<%=Request("rechercheCateg")%>">Prix</a>
    							<% Else  %>
    								<a href="passerCommande.asp?Tri=5&Page=<%=Request("Page")%>&idClient=<%=Request("idClient")%>&idCommande=<%=Request("idCommande")%>&rechercheRef=<%=Request("rechercheRef")%>&rechercheCateg=<%=Request("rechercheCateg")%>">Prix</a>
    							<% End If %>
    						</th>
    						<th bgcolor="#B0F5FF" width="5%"class="seeme" style="border-top-style: solid; border-top-width: 1px">
    							<font color="#008080">Quantité
    						</font>
    						</th>
    						<th bgcolor="#B0F5FF" width="11%"class="seeme" style="border-top-style: solid; border-top-width: 1px">
    							<font color="#008080">Nom Abonné
    						</font>
     
    					</tr>
    					<% dim i
    						i=0
    						DO WHILE NOT (rstAff2.EOF or i=6)%>
    					<tr class="seeme">
    						<td bgcolor="#E8FCFF" width="7%" class="seeme"><%=rstAff2("prodRef")%>&nbsp;</td>
    						<td bgcolor="#E8FCFF" width="48%" class="seeme"><%=rstAff2("prodLib")%>&nbsp;</td>
    						<td bgcolor="#E8FCFF" align="right" width="7%" class="seeme"><%=FormatNumber(rstAff2("prodPu"),2,-1,0,-1)%> €</td>
    						<td bgcolor="#E8FCFF" align="right" width="5%" class="seeme">
    						<p align="center">
    						<input type="text" name="comQt<%=rstAff2("idProd")%>" size="5" value="1" align="center" style="font-size: 10;"></td>
    						<td bgcolor="#E8FCFF" align="right" width="11%" class="seeme">
    						<p align="center">
     
    						<input type="text" name="Nomabo<%=rstAff2("idProd")%>" size="18" value="" align="center" style="font-size: 10;"></td>
     
    						<td bgcolor="#FFFFFF" align="center" width="13%" class="seeme"><a href="javascript:centrerPopup('descriptifProduit.asp?idProd=<%=rstAff2("idProd")%>',310,280,'menubar=no,scrollbars=yes,statusbar=no')">
    						<font color="#FF0000">Descriptif</font></a></td>
    						<td bgcolor="#FFFFFF" align="center" width="6%" class="seeme">
    						<font color="#FF0000">
    						<%	rstNbDansComm="SELECT COUNT(commanderTemp.idProd) AS Nombre From commanderTemp WHERE commanderTemp.idComm = " & numCommande & " AND commanderTemp.idProd = " & rstAff2("idProd")
    							set rstNbProd=MaConn.Execute(rstNbDansComm)
    							if rstNbProd("Nombre")=0 then%>
    							</font>
    							<a href="javascript:Ajout(<%=rstAff2("idProd")%>,'<%=replace(rstAff2("prodLib"),"'","\'")%>')">
    						<font color="#FF0000">Ajouter</font></a></td>
    						<%end if%>
    					</tr>
    					<%	rstAff2.MoveNext
    						i=i+1
    						LOOP%>
     
     
    'partie panier
    <table cellspacing="2" cellpadding="2" border="2" bordercolor=#000000 width="100%" class="petit" class="noseeme" style="border-left-width: 0px; border-right-width: 0px; border-top-width: 0px">
    				<tr>
    					<td colspan="6" align="center" style="border-style: none; border-width: medium">
    				</tr>
    				<tr>
    					<th bgcolor="#FFFF84" style="border-style: solid; border-width: 1px" width="11%">Référence</th>
    					<th bgcolor="#FFFF84" style="border-style: solid; border-width: 1px" width="26%">Libellé</th>
    					<th bgcolor="#FFFF84" style="border-style: solid; border-width: 1px" width="11%">Prix</th>
    					<th bgcolor="#FFFF84" style="border-style: solid; border-width: 1px" width="8%">Quantité</th>
    					<th bgcolor="#FFFF84" style="border-style: solid; border-width: 1px" width="12%">Nom Abonné</th>
    					<th bgcolor="#FFFF84" style="border-left-style: solid; border-left-width: 1px; border-top-style: solid; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px" width="23%">Total</th>
    				</tr>
    				<% DO WHILE NOT rstAff3.EOF %>
    				<tr>
    					<td bgcolor="#FFFFBB" style="border-style: solid; border-width: 1px" width="11%"><%=rstAff3("prodRef")%>&nbsp;</td>
    					<td bgcolor="#FFFFBB" style="border-style: solid; border-width: 1px" width="26%"><%=rstAff3("prodLib")%>&nbsp;</td>
    					<td bgcolor="#FFFFBB" align="right" style="border-style: solid; border-width: 1px" width="11%"><%=FormatNumber(rstAff3("prodPu"),2,-1,0,-1)%> €</td>
    					<td bgcolor="#FFFFBB" align="right" style="border-style: solid; border-width: 1px" width="8%"><%=rstAff3("comQt")%>&nbsp;</td>
    					<td bgcolor="#FFFFBB" align="right" style="border-style: solid; border-width: 1px" width="12%"><%=rstAff3("Nomabo")%>&nbsp;</td>
    					<td bgcolor="#FFFFBB" align="right" style="border-style: solid; border-width: 1px" width="23%"><%=FormatNumber(rstAff3("Total"),2,-1,0,-1)%> €</td>
    					<td bgcolor="#FFFFFF" align="center" class="seeme" style="border-left-style: solid; border-left-width: 1px; border-right-style: solid; border-right-width: 1px" width="15%"><a href="SuppProdComm.asp?idProd=<%=rstAff3("idProd")%>&idComm=<%=numCommande%>&idClient=<%=Request("idClient")%>&Page=<%=Request("Page")%>&rechercheRef=<%=Request("rechercheRef")%>&rechercheCateg=<%=Request("rechercheCateg")%>&Tri=<%=Request("Tri")%>">
    					<font color="#FF0000">Retirer</font></a></td>
    				</tr>
    				<%	rstAff3.MoveNext
    					LOOP%>
    				 <tr>
     
    <% MaConn.Close %>
    voila pour la page passercommande tout marcher bien avant jusqu'a que j'integre l'input text et le parametre Nomabo

    Enfin voici le fichier ajoutprodcommand.asp qui est appeler lorque que l'on ajoute un produit au panier
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    <%  Response.Expires = -1
        Response.AddHeader "Pragma", "no-cache"
        Response.AddHeader "cache-control", "no-store"
     
    	set MaConn=Server.CreateObject("ADODB.Connection")
    	MaConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath ("gestion.mdb") & ";Persist Security Info=False"
    	deleteProduit="DELETE FROM commanderTemp WHERE commanderTemp.idProd = " & Request("idProd") & " AND commanderTemp.idComm= " & Request("idComm")
    	ajoutProduit="INSERT INTO commanderTemp(idProd,idComm,comQt,Nomabo) VALUES (" & Request("idProd") & "," & Request("idComm") & "," & Request("comQt") & "," & Request("Nomabo") & ")" 
    	MaConn.Execute(deleteProduit)
    	MaConn.Execute(ajoutProduit)
    	MaConn.Close
    	response.redirect ("passerCommande.asp?idClient=" & Request("idClient") & "&idCommande=" & Request("idComm") & "&Page=" & Request("Page") & "&rechercheRef=" & Request("rechercheRef") & "&rechercheCateg=" & Request("rechercheCateg") & "&Tri=" & Request("Tri"))%>
    voila le message d'erreur est que soit disans il manque des parametre alors que dans le message d'erreur tout les parametres sont passé y compris Nomabo donc je comprend pas....

    Aide d'un jedi svp....

    En gros comment fait on pour récuperer une chaine de caractères dans un catalogue dans une base et le réafficher dans un panier je suis très pres du but je pense ....

    Merci beaucoup d'avance...

    c'est assez important..... Merci

    Jp

  2. #2
    Membre à l'essai
    Inscrit en
    Janvier 2004
    Messages
    24
    Détails du profil
    Informations forums :
    Inscription : Janvier 2004
    Messages : 24
    Points : 12
    Points
    12
    Par défaut
    Personne n'a pu se pencher sur mon ptit problème


  3. #3
    Membre à l'essai
    Inscrit en
    Janvier 2004
    Messages
    24
    Détails du profil
    Informations forums :
    Inscription : Janvier 2004
    Messages : 24
    Points : 12
    Points
    12
    Par défaut
    Bon je remercie ceux qui se sont pencher sur mon problème meme si il y a pas eu foule de reponse enfin j'ai trouver la solution...

    pour ceux que ca interesse il manquait juste des ' ' pour le insert into de la zone de texte.... comme quoi j'était très pres de la soluce ...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
     ajoutProduit="INSERT INTO commanderTemp(idProd,idComm,comQt,Nomabo) VALUES (" & Request("idProd") & "," & Request("idComm") & "," & Request("comQt") & ",'" & Request("Nomabo") & "')"
    voila jai un autre petit problème mais je vous en ferai par plus tard..

    Bonne journée à tous.

    jp

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Afficher des images avec des espaces dans le nom
    Par Space Cowboy dans le forum Balisage (X)HTML et validation W3C
    Réponses: 3
    Dernier message: 15/03/2007, 07h18
  2. [MySQL] impossible d'afficher des images en provenance de la DB
    Par paricilas dans le forum PHP & Base de données
    Réponses: 5
    Dernier message: 21/02/2007, 22h08
  3. Exporter des données avec les insert
    Par maximenet dans le forum MS SQL Server
    Réponses: 1
    Dernier message: 03/04/2006, 16h20
  4. [EasyPHP] impossible de faire des URLS avec variable
    Par SandraG dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 9
    Dernier message: 30/03/2006, 17h38
  5. Rétablir des parametres avec Windows XP
    Par Premium dans le forum Windows XP
    Réponses: 7
    Dernier message: 30/01/2006, 14h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo