Java - Error para insertar datos desde java netbeans a mysql.

 
Vista:

Error para insertar datos desde java netbeans a mysql.

Publicado por Jessica Sarahi (1 intervención) el 05/09/2020 01:59:33
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

Soy aun principiante en programación; sin embargo estoy desarrollando un programa de inventario, quiero añadir productos de tlapaleria desde netbeans mediante textfield a mi base de datos de mysql usando xampp. Pero al intentar insertar alguno me sale el error. java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0). Como nota, mis tipos de datos son string, son 5 atributos, anteriormente tenia a codigo y precio como entero y float, pero me salia el mismo error, talvez por que necesitaba convertir. No soy muy buena aun programando :3

A continuacion mi codigo de mi clase inventario

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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
package tlapalero;
 
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
 
 
public class Inventario extends javax.swing.JFrame {
 
 
Conexion con=new Conexion();
Connection cn=con.conexion();
 
    public Inventario() {
        initComponents();
        limpiar();
        bloquear();
 
    }
 
 
 
 
 
 
    void limpiar(){
    txtcodigo.setText("");
    txtproducto.setText("");
    txtmarca.setText("");
    txtdescripcion.setText("");
    txtprecio.setText("");
    }
 
    void bloquear(){
    txtcodigo.setEnabled(false);
    txtproducto.setEnabled(false);
    txtmarca.setEnabled(false);
    txtdescripcion.setEnabled(false);
    txtprecio.setEnabled(false);
    buttonnuevo.setEnabled(true);
    buttonguardar.setEnabled(false);
    buttoncancelar.setEnabled(false);
    }
 
    void desbloquear(){
    txtcodigo.setEnabled(true);
    txtproducto.setEnabled(true);
    txtmarca.setEnabled(true);
    txtdescripcion.setEnabled(true);
    txtprecio.setEnabled(true);
    buttonnuevo.setEnabled(false);
    buttonguardar.setEnabled(true);
    buttoncancelar.setEnabled(true);
    }
 
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
 
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtcodigo = new javax.swing.JTextField();
        txtproducto = new javax.swing.JTextField();
        txtmarca = new javax.swing.JTextField();
        txtdescripcion = new javax.swing.JTextField();
        txtprecio = new javax.swing.JTextField();
        buttonguardar = new javax.swing.JButton();
        buttonnuevo = new javax.swing.JButton();
        buttoncancelar = new javax.swing.JButton();
        buttonsalir = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        t_productos = new javax.swing.JTable();
 
        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);
 
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
 
        jPanel1.setBackground(new java.awt.Color(153, 255, 255));
 
        jLabel1.setFont(new java.awt.Font("Dialog", 0, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(0, 0, 0));
        jLabel1.setText("AÑADIR PRODUCTOS");
 
        jLabel2.setForeground(new java.awt.Color(0, 0, 0));
        jLabel2.setText("Código ");
 
        jLabel3.setForeground(new java.awt.Color(0, 0, 0));
        jLabel3.setText("Producto");
 
        jLabel4.setForeground(new java.awt.Color(0, 0, 0));
        jLabel4.setText("Descripción");
 
        jLabel5.setForeground(new java.awt.Color(0, 0, 0));
        jLabel5.setText("Precio");
 
        jLabel6.setForeground(new java.awt.Color(0, 0, 0));
        jLabel6.setText("Marca");
 
        txtcodigo.setBackground(new java.awt.Color(255, 255, 255));
        txtcodigo.setForeground(new java.awt.Color(0, 0, 0));
        txtcodigo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtcodigoActionPerformed(evt);
            }
        });
 
        txtproducto.setBackground(new java.awt.Color(255, 255, 255));
        txtproducto.setForeground(new java.awt.Color(0, 0, 0));
        txtproducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtproductoActionPerformed(evt);
            }
        });
 
        txtmarca.setBackground(new java.awt.Color(255, 255, 255));
        txtmarca.setForeground(new java.awt.Color(0, 0, 0));
        txtmarca.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtmarcaActionPerformed(evt);
            }
        });
 
        txtdescripcion.setBackground(new java.awt.Color(255, 255, 255));
        txtdescripcion.setForeground(new java.awt.Color(0, 0, 0));
        txtdescripcion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtdescripcionActionPerformed(evt);
            }
        });
 
        txtprecio.setBackground(new java.awt.Color(255, 255, 255));
        txtprecio.setForeground(new java.awt.Color(0, 0, 0));
        txtprecio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtprecioActionPerformed(evt);
            }
        });
 
        buttonguardar.setBackground(new java.awt.Color(255, 255, 255));
        buttonguardar.setForeground(new java.awt.Color(0, 0, 0));
        buttonguardar.setText("Guardar");
        buttonguardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonguardarActionPerformed(evt);
            }
        });
 
        buttonnuevo.setBackground(new java.awt.Color(255, 255, 255));
        buttonnuevo.setForeground(new java.awt.Color(0, 0, 0));
        buttonnuevo.setText("Nuevo");
        buttonnuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonnuevoActionPerformed(evt);
            }
        });
 
        buttoncancelar.setBackground(new java.awt.Color(255, 255, 255));
        buttoncancelar.setForeground(new java.awt.Color(0, 0, 0));
        buttoncancelar.setText("Cancelar");
        buttoncancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttoncancelarActionPerformed(evt);
            }
        });
 
        buttonsalir.setBackground(new java.awt.Color(255, 255, 255));
        buttonsalir.setForeground(new java.awt.Color(0, 0, 0));
        buttonsalir.setText("Salir");
        buttonsalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonsalirActionPerformed(evt);
            }
        });
 
        t_productos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {},
                {},
                {},
                {}
            },
            new String [] {
 
            }
        ));
        jScrollPane2.setViewportView(t_productos);
 
        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(37, 37, 37)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel4)
                                            .addComponent(jLabel5))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(txtdescripcion)
                                            .addComponent(txtprecio, javax.swing.GroupLayout.DEFAULT_SIZE, 154, Short.MAX_VALUE)))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(jLabel2)
                                            .addComponent(jLabel3)
                                            .addComponent(jLabel6))
                                        .addGap(31, 31, 31)
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(txtcodigo, javax.swing.GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE)
                                            .addComponent(txtproducto)
                                            .addComponent(txtmarca))))
                                .addGap(311, 311, 311)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(buttoncancelar)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGap(12, 12, 12)
                                        .addComponent(buttonsalir))
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                        .addComponent(buttonnuevo)
                                        .addComponent(buttonguardar))))
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(162, 162, 162)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 431, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonnuevo))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtcodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonguardar))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtproducto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttoncancelar))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(txtmarca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonsalir))
                .addGap(6, 6, 6)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(txtdescripcion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(txtprecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(104, 104, 104)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(238, Short.MAX_VALUE))
        );
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
 
        pack();
    }// </editor-fold>
 
    private void txtcodigoActionPerformed(java.awt.event.ActionEvent evt) {
       txtcodigo.transferFocus();
    }
 
    private void buttonguardarActionPerformed(java.awt.event.ActionEvent evt) {
    limpiar();
    desbloquear();
    try {
        PreparedStatement pps= cn.prepareStatement("INSERT INTO PRODUCTOS(CODIGO,PRODUCTO,MARCA,DESCRIPCION,PRECIO) VALUES('?','?','?','?','?')");
        pps.setString(1,txtcodigo.getText());
        pps.setString(2,txtproducto.getText());
        pps.setString(3,txtmarca.getText());
        pps.setString(4,txtdescripcion.getText());
        pps.setString(5,txtprecio.getText());
        int n=pps.executeUpdate();
        if(n>0){
         JOptionPane.showMessageDialog(null,"Datos Guardados");
         bloquear();
        }
 
    } catch (SQLException ex) {
        JOptionPane.showMessageDialog(null, ex);
        Logger.getLogger(Inventario.class.getName()).log(Level.SEVERE, null, ex);
    }
 
 
 
    }
 
    private void txtmarcaActionPerformed(java.awt.event.ActionEvent evt) {
        txtmarca.transferFocus();
    }
 
    private void txtproductoActionPerformed(java.awt.event.ActionEvent evt) {
       txtproducto.transferFocus();
    }
 
    private void txtdescripcionActionPerformed(java.awt.event.ActionEvent evt) {
         txtdescripcion.transferFocus();
    }
 
    private void txtprecioActionPerformed(java.awt.event.ActionEvent evt) {
        txtprecio.transferFocus();
    }
 
    private void buttonnuevoActionPerformed(java.awt.event.ActionEvent evt) {
    limpiar();
    desbloquear();
    txtcodigo.requestFocus();
 
    }
 
    private void buttoncancelarActionPerformed(java.awt.event.ActionEvent evt) {
        bloquear();
    }
 
    private void buttonsalirActionPerformed(java.awt.event.ActionEvent evt) {
       this.dispose();
    }
 
 
    public static void main(String args[]) {
 
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(Inventario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Inventario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Inventario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Inventario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
 
        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Inventario().setVisible(true);
            }
        });
    }
 
    // Variables declaration - do not modify
    private javax.swing.JButton buttoncancelar;
    private javax.swing.JButton buttonguardar;
    private javax.swing.JButton buttonnuevo;
    private javax.swing.JButton buttonsalir;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTable1;
    private javax.swing.JTable t_productos;
    private javax.swing.JTextField txtcodigo;
    private javax.swing.JTextField txtdescripcion;
    private javax.swing.JTextField txtmarca;
    private javax.swing.JTextField txtprecio;
    private javax.swing.JTextField txtproducto;
    // End of variables declaration
}
 
 
Codigo de mi conexión:
package tlapalero;
import java.awt.HeadlessException;
import java.sql.*;
import javax.swing.JOptionPane;
public class Conexion {
   Connection cn;
   Statement st;
   private static final String user ="root";
   private static final String password ="";
   private static final String url = "jdbc:mysql://localhost:3306/tlapaleria";
 
    public Connection conexion() {
        try {
        Class.forName("com.mysql.jdbc.Driver");
        cn = DriverManager.getConnection(url, user, password);
        JOptionPane.showMessageDialog(null,"Conexión establecida");
    } catch(HeadlessException | ClassNotFoundException | SQLException e){
        System.out.println("error al conectar"+ e);
    }
    return cn;
}
    Statement createStatement(){
        throw new UnsupportedOperationException("No soportado");
}
}

La conexion con mi base de datos si resulta pero no me deja insertar datos.
Al quitarle las comillas en la sentencia sql me inserta solo una fila pero en mysql no me aparece nada, solo me aparece la fila vacia. Si despues quiero insertar otra fila me sale un error de violación de llave primaria.
Si alguien pudiera decirme en donde estoy mal, se lo agradecere :3
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Rodrigo
Val: 2.041
Plata
Ha mantenido su posición en Java (en relación al último mes)
Gráfica de Java

Error para insertar datos desde java netbeans a mysql.

Publicado por Rodrigo (623 intervenciones) el 05/09/2020 16:49:21
En el insert, en vez de usar '?' usa ? (sin comillas alrededor).
Si el codigo del producto es llave primaria de la tabla esta bien que la BD no te deje insertar una segunda vez si repites el codigo.
Ingresa codigos distintos cada vez.

O bien haz la consulta a la BD antes de insertar.
O bien captura la excepcion al momento de insertar en vez de dejar que ella bote tu programa.

Podrias poner todo lo relacionado con el acceso a los datos en una clase aparte y en esta que esta aqui que tiene codigo de interfaz de usuario y visualizacion solo instanciar la clase e invocar los metodos.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de Sandro
Val: 392
Bronce
Ha mantenido su posición en Java (en relación al último mes)
Gráfica de Java

Error para insertar datos desde java netbeans a mysql.

Publicado por Sandro (166 intervenciones) el 06/09/2020 16:48:51
aquí el error pienso que es por índices
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

estas tratando de tomar un datos, de un ocurrencia la cual esta vacía, manda el error completo
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar