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

JDBC Java Discussion :

Insertion dans la BD MySQL


Sujet :

JDBC Java

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 51
    Points : 32
    Points
    32
    Par défaut Insertion dans la BD MySQL
    bonjour;
    j'ai un petit problème d'insertion dans la BD;mais je ne sais pas c'est quoi ce problème d'après mes connaissances le code que j'ai écrit est correcte;
    voici le servlet qui fait l'insertion:
    [QUOTE]
    package Db_cnx;


    import java.io.IOException;
    import java.io.PrintWriter;

    import java.sql.*;


    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;


    public class Cnx_srv extends HttpServlet {
    private static final long serialVersionUID = 1L;
    private Connection cnx=null;
    private PreparedStatement instruction =null;
    private String req="insert into produits values(?,?,?,?,?,?)";

    public void init() throws ServletException{
    String pilote =getInitParameter("jdbc");
    String db =getInitParameter("localisation");
    try {
    Class.forName(pilote);
    Connection cnx=DriverManager.getConnection(db,"root","");
    instruction = cnx.prepareStatement(req);

    }
    catch (SQLException e)
    {
    System.out.println("erreur1111");
    } catch (ClassNotFoundException e) {

    System.out.println("erreur22222");
    }
    }


    public Cnx_srv() {

    }


    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try{
    PrintWriter out = response.getWriter();
    System.out.println(Integer.valueOf(request.getParameter("qte")));
    instruction.setString(1,request.getParameter("ref"));
    instruction.setString(2,request.getParameter("desig"));
    instruction.setString(3,request.getParameter("parcourir"));
    instruction.setDouble(4,Double.valueOf(request.getParameter("pu")));
    instruction.setInt(5,Integer.valueOf(request.getParameter("qte")));
    instruction.setString(6,request.getParameter("sel_ref_cat"));

    instruction.executeUpdate();
    response.setContentType("text/html");
    out.println("<html><head><title>Reponse formulaire</title></head><body>");
    out.println("<H2>Enregistrement effectué</h2>");
    out.println("</body></html>");
    }
    catch (SQLException e){System.out.println("non enregistrer");}


    }
    public void destroy(){
    if(cnx!=null){
    try {
    cnx.close();
    }
    catch(SQLException e){
    System.out.println("erreur");
    }
    }
    }


    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    }


    voici le code jsp:

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Information Produit</title>
    </head>

    <body>
    <FORM METHOD="GET" ACTION="Cnx_srv">
    <table>

    <tr>
    <td>
    Reference Produit:
    </td>
    <td>
    <input type=text name="ref" value="Entrer un Reference">
    </td>
    </tr>
    <tr>
    <td>
    Designation produit:
    </td>
    <td>
    <input type=text name="desig">
    </td>
    </tr>
    <tr>
    <td>
    Image produit:
    </td>
    <td>
    <input type="file" name="parcourir" value="Brows">
    </td></tr>
    <tr>
    <td>
    Prix Unitaire produit:
    </td>
    <td>
    <input type=text name="pu" value="Prix Unitaire">
    </td></tr>
    <tr>
    <td>
    Quantité produit:
    </td>
    <td>
    <input type=text name="qte" value="Quantité">
    </td></tr>
    <tr>
    <td>
    Reference Categorie:
    </td>
    <td>
    <select name="sel_ref_cat"">
    <option value="cat1" SELECTED >cat1</option>
    <option value="cat2">cat2</option>
    <option value="cat3">cat3</option>
    </select>
    </td></tr>
    <tr><td>
    <input type="submit" value="Enregistrer">
    </td></tr>

    </table>
    </FORM>

    </body>
    </html>
    voici le web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>Ecommerce</display-name>
    <servlet>
    <description>
    </description>
    <display-name>Cnx_srv</display-name>
    <servlet-name>Cnx_srv</servlet-name>
    <servlet-class>Db_cnx.Cnx_srv</servlet-class>
    <init-param>
    <param-name>jdbc</param-name>
    <param-value>com.mysql.jdbc.Driver</param-value>
    </init-param>
    <init-param>
    <param-name>localisation</param-name>
    <param-value>jdbc:mysql://localhost/db_ecom</param-value>
    </init-param>

    </servlet>
    <servlet-mapping>
    <servlet-name>Cnx_srv</servlet-name>
    <url-pattern>/Cnx_srv</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
    merci d'avance

  2. #2
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 51
    Points : 32
    Points
    32
    Par défaut
    j'ai oublié de vous dire que le programme m'affiche le message suivant:
    "non enregistrer"

  3. #3
    Membre confirmé
    Inscrit en
    Juillet 2006
    Messages
    534
    Détails du profil
    Informations forums :
    Inscription : Juillet 2006
    Messages : 534
    Points : 562
    Points
    562
    Par défaut
    Peux-tu mettre les balises CODE dans ton programme ?

  4. #4
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 51
    Points : 32
    Points
    32
    Par défaut
    peux tu m'expliquer plus? quelle balise? je crois que j'ai met tout le programme que j'ai écrit

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 106
    Points : 121
    Points
    121
    Par défaut
    Un truc dans ce genre la :

    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
    package Db_cnx;
     
     
    import java.io.IOException;
    import java.io.PrintWriter;
     
    import java.sql.*;
     
     
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
     
     
    public class Cnx_srv extends HttpServlet {
    	private static final long serialVersionUID = 1L;
    	private Connection cnx=null;
    	private PreparedStatement instruction =null;
    	private String req="insert into produits values(?,?,?,?,?,?)";
     
    	public void init() throws ServletException{
    		String pilote =getInitParameter("jdbc");
    		String db =getInitParameter("localisation");
    		try {
    			Class.forName(pilote);
    			Connection cnx=DriverManager.getConnection(db,"root","");
    			instruction =  cnx.prepareStatement(req);
     
    		}
    		catch (SQLException e)
    		{
    			System.out.println("erreur1111");
    		} catch (ClassNotFoundException e) {
     
    			System.out.println("erreur22222");
    		}
    	}
     
     
        public Cnx_srv() {
     
        }
     
     
    	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    		try{
    			PrintWriter out = response.getWriter();
    				System.out.println(Integer.valueOf(request.getParameter("qte")));
    			instruction.setString(1,request.getParameter("ref"));
    			instruction.setString(2,request.getParameter("desig"));
    			instruction.setString(3,request.getParameter("parcourir"));
    			instruction.setDouble(4,Double.valueOf(request.getParameter("pu")));
    			instruction.setInt(5,Integer.valueOf(request.getParameter("qte")));
    			instruction.setString(6,request.getParameter("sel_ref_cat"));
     
    			instruction.executeUpdate();
    			response.setContentType("text/html");
    				out.println("<html><head><title>Reponse formulaire</title></head><body>");
    			out.println("<H2>Enregistrement effectué</h2>");
    			out.println("</body></html>");
    		}
    		catch (SQLException e){System.out.println("non enregistrer");}
     
     
    	}
    	public void destroy(){
    		if(cnx!=null){
    			try {
    				cnx.close();
    			}
    			catch(SQLException e){
    				System.out.println("erreur");
    			}
    		}
    	}
     
     
    	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     
    	}
     
    }
    JSP :

    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
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Information Produit</title>
    </head>
     
    <body>
    <FORM METHOD="GET" ACTION="Cnx_srv">
    <table>
     
    <tr>
    <td>
    Reference Produit:
    </td>
    <td>
    <input type=text name="ref" value="Entrer un Reference">
    </td>
    </tr>
    <tr>
    <td>
    Designation produit:
    </td>
    <td>
    <input type=text name="desig">
    </td>
    </tr>
    <tr>
    <td>
    Image produit:
    </td>
    <td>
    <input type="file" name="parcourir" value="Brows">
    </td></tr>
    <tr>
    <td>
    Prix Unitaire produit:
    </td>
    <td>
    <input type=text name="pu" value="Prix Unitaire">
    </td></tr>
    <tr>
    <td>
    Quantité produit:
    </td>
    <td>
    <input type=text name="qte" value="Quantité">
    </td></tr>
    <tr>
    <td>
    Reference Categorie:
    </td>
    <td>
    <select name="sel_ref_cat"">
    <option value="cat1" SELECTED >cat1</option>
    <option value="cat2">cat2</option>
    <option value="cat3">cat3</option>
    </select>
    </td></tr>
    <tr><td>
    <input type="submit" value="Enregistrer">
    </td></tr>
     
    </table>
    </FORM>
     
    </body>
    </html>
    web.xml :
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlnssi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <display-name>Ecommerce</display-name>
    <servlet>
    <description>
    </description>
    <display-name>Cnx_srv</display-name>
    <servlet-name>Cnx_srv</servlet-name>
    <servlet-class>Db_cnx.Cnx_srv</servlet-class>
    <init-param>
    <param-name>jdbc</param-name> 
    <param-value>com.mysql.jdbc.Driver</param-value>
    </init-param>
    <init-param>
    <param-name>localisation</param-name>
    <param-value>jdbc:mysql://localhost/db_ecom</param-value>
    </init-param>
     
    </servlet>
    <servlet-mapping>
    <servlet-name>Cnx_srv</servlet-name>
    <url-pattern>/Cnx_srv</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    </web-app>

  6. #6
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 51
    Points : 32
    Points
    32
    Par défaut
    ah d'accord;
    Merci

  7. #7
    Membre éprouvé Avatar de noOneIsInnocent
    Homme Profil pro
    Inscrit en
    Mai 2002
    Messages
    1 037
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2002
    Messages : 1 037
    Points : 1 161
    Points
    1 161
    Par défaut
    Donne nous la stack de l'exception ça pourra nous aider

  8. #8
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 51
    Points : 32
    Points
    32
    Par défaut
    d'accord;
    je crois que le probleme est dans cette partie du code, et que l'instruction executeupdate ne s'execute pas

    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
     
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    		try{
    			PrintWriter out = response.getWriter();
    				System.out.println(Integer.valueOf(request.getParameter("qte")));
    			instruction.setString(1,request.getParameter("ref"));
    			instruction.setString(2,request.getParameter("desig"));
    			instruction.setString(3,request.getParameter("parcourir"));
    			instruction.setDouble(4,Double.valueOf(request.getParameter("pu")));
    			instruction.setInt(5,Integer.valueOf(request.getParameter("qte")));
    			instruction.setString(6,request.getParameter("sel_ref_cat"));
    			System.out.println(request.getParameter("sel_ref_cat"));
    			instruction.executeUpdate();
    			//instruction.execute();
    			System.out.println(Integer.valueOf(request.getParameter("qte")));
    			response.setContentType("text/html");
    				out.println("<html><head><title>Reponse formulaire</title></head><body>");
    			out.println("<H2>Enregistrement effectué</h2>");
    			out.println("</body></html>");
    		}
    		catch (SQLException e){System.out.println("non enregistrer");}
     
     
    	}
    Merci

  9. #9
    Membre régulier
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 106
    Points : 121
    Points
    121
    Par défaut
    A la place de :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    catch (SQLException e){System.out.println("non enregistrer");}
    tu veux pas mettre :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    catch (SQLException e){e.printStackTrace()}
    et nous donner le resultat ???

  10. #10
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 51
    Points : 32
    Points
    32
    Par défaut
    VOICI LE RESULTAT


    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
     
     
    java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
    	at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:2569)
    	at com.mysql.jdbc.PreparedStatement.setString(PreparedStatement.java:3397)
    	at Db_cnx.Cnx_srv.doGet(Cnx_srv.java:52)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    	at java.lang.Thread.run(Unknown Source)

  11. #11
    Membre éprouvé Avatar de noOneIsInnocent
    Homme Profil pro
    Inscrit en
    Mai 2002
    Messages
    1 037
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2002
    Messages : 1 037
    Points : 1 161
    Points
    1 161
    Par défaut
    il faut que tu commences tes index à 0

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    instruction.setString(0,request.getParameter("ref"));
    			instruction.setString(1,request.getParameter("desig"));
    			instruction.setString(2,request.getParameter("parcourir"));
    			instruction.setDouble(3,Double.valueOf(request.getParameter("pu")));
    			instruction.setInt(4,Integer.valueOf(request.getParameter("qte")));
    			instruction.setString(5,request.getParameter("sel_ref_cat"));
    			System.out.println(request.getParameter("sel_ref_cat"));

  12. #12
    Membre éprouvé Avatar de noOneIsInnocent
    Homme Profil pro
    Inscrit en
    Mai 2002
    Messages
    1 037
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2002
    Messages : 1 037
    Points : 1 161
    Points
    1 161
    Par défaut
    ah non désolé je me suis trompé. Est-ce que tu arrives à afficher le parametre sel_ref_cat ?Essaie de faire afficher tes résultats de requêtes un par un , ou met toi en debug pour voir quel paramètre tu ne récupères pas correctement ?

  13. #13
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 51
    Points : 32
    Points
    32
    Par défaut
    MERCI pour ta réponse;
    mais je trouve toujours le même problème pas d'insertion avec le même message d'erreur.

  14. #14
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 51
    Points : 32
    Points
    32
    Par défaut
    oui tout les paramètres s'affichent correctement

  15. #15
    Membre éprouvé Avatar de noOneIsInnocent
    Homme Profil pro
    Inscrit en
    Mai 2002
    Messages
    1 037
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mai 2002
    Messages : 1 037
    Points : 1 161
    Points
    1 161
    Par défaut
    tu peux nous poster la structure de ta table stp ? et à quelle ligne intervient l'erreur puis la valeur que tu essaies d'insérer dans ta table pour cette ligne

  16. #16
    Membre régulier
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 106
    Points : 121
    Points
    121
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
    Apparemment, il fait mal le prepare statement de ta string req, car pour lui, il n y a aucun parametre a rajouter a ton statement.

  17. #17
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 51
    Points : 32
    Points
    32
    Par défaut
    je vous remercie pour l'intérêt que vous donner a mon probleme.
    Voila la structure de la table:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    CREATE TABLE IF NOT EXISTS `produits` (
      `Ref_pdt` varchar(15) NOT NULL,
      `Desg_pdt` varchar(20) NOT NULL,
      `Img_pdt` varchar(50) NOT NULL,
      `Pu_pdt` float NOT NULL,
      `Qte_pdt` int(12) NOT NULL,
      `Ref_cat` varchar(15) NOT NULL,
      PRIMARY KEY (`Ref_pdt`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

  18. #18
    Membre régulier
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 106
    Points : 121
    Points
    121
    Par défaut
    Tu nas pas eu de message 'erreur1111' avant léxception qui est levee ?

  19. #19
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Janvier 2008
    Messages
    51
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Janvier 2008
    Messages : 51
    Points : 32
    Points
    32
    Par défaut
    non y'a aucun message d'erreur sauf l'exception

  20. #20
    Membre régulier
    Profil pro
    Inscrit en
    Mai 2009
    Messages
    106
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2009
    Messages : 106
    Points : 121
    Points
    121
    Par défaut
    Dans la methode init, enleve la redefinition de Connection cnx car elle est deja en variable globale et voit ce que sa donne (pas sur ke ce soit sa mais essaie )

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Réponses: 2
    Dernier message: 03/05/2007, 09h00
  2. [MySQL] problème d'insertion dans ma BD MySQL
    Par Kerrisson dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 24/04/2007, 22h50
  3. [VB.NET][MySQL]ID insertion dans une base MySQL par ODBC
    Par leSeb dans le forum Windows Forms
    Réponses: 2
    Dernier message: 21/03/2006, 10h58
  4. Problème d'insertion dans une table MYSQL
    Par greg69 dans le forum Requêtes
    Réponses: 4
    Dernier message: 24/10/2005, 11h34
  5. insertion dans une DB mySQL
    Par preacher_man dans le forum Bibliothèques tierces
    Réponses: 3
    Dernier message: 13/10/2005, 21h14

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