私はMySQLデータベースに13列のテーブルを持っています。最初の列は自動インクリメントで、残りは通常です。私はこれを持っています:
SQL="INSERT INTO cuentas (id_proveedor_cloud,id_esquema_asociado,id_tipo_cuenta,n_cuenta,nombre_cuenta,cod_cliente"+
"descuento,f_creacion,borrado,f_borrado,id_cuenta_ccis,logo)"+
" VALUES("+
"?,?,?,?,?,?,?,?,?,?,?,?);";
this.pstm = this.conexion.prepareStatement(SQL);
this.pstm.setInt(1, proveedor);
this.pstm.setInt(2, esquema);
this.pstm.setInt(3, cuenta.getNivel());
this.pstm.setString(4,num_c);
this.pstm.setString(5, cuenta.getNombre_cuenta());
this.pstm.setString(6, "");
this.pstm.setDouble(7, cuenta.getDescuento());
this.pstm.setString(8,dateFormat.format(cal.getTime()).toString());
this.pstm.setBoolean(9, cuenta.isBorrado());
if(cuenta.isBorrado()==false){
this.pstm.setString(10,null);
}else{
this.pstm.setString(10, dateFormat.format(cal.getTime()).toString());
}
this.pstm.setInt(11, cuenta.getId_cuenta_padre());
this.pstm.setBytes(12, cuenta.getLogo());
int ejecutado = this.pstm.executeUpdate();
次の間違いがあります: java.sql.SQLException: Column count doesn't match value count at row 1
、なぜですか?
自動インクリメントの列は明らかにここにはありません。それがなければ、12 列になります。