Beruflich Dokumente
Kultur Dokumente
/**
*
* E-Mail : shamirdhc31@gmail.com
* Blog
: http://javadhc.blogspot.com
*
*/
import
import
import
import
import
import
import
java.sql.Connection;
java.sql.DriverManager;
java.sql.ResultSet;
java.sql.SQLException;
java.sql.Statement;
javax.swing.JOptionPane;
javax.swing.table.DefaultTableModel;
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
Class.forName("org.gjt.mm.mysql.Driver");
this.CanalBD = DriverManager.getConnection(this.DireccionBD,this.U
this.Instruccion = this.CanalBD.createStatement(ResultSet.TYPE_SCR
}
catch(SQLException SQLE)
{
JOptionPane.showMessageDialog(null,"ERROR EN LA CONEXION CON BD\nE
}
catch(ClassNotFoundException CNFE)
{
JOptionPane.showMessageDialog(null,"ERROR DRIVER BD JAVA\nERROR :
}
}
public void InsertInsertar(String SentenciaSQL)
{
this.SentenciaSQL = SentenciaSQL;
try
{
this.Instruccion.executeUpdate(this.SentenciaSQL);
JOptionPane.showMessageDialog(null,"EL REGISTRO SE AGREGO CON EXIT
}
catch (SQLException SQLE)
{
JOptionPane.showMessageDialog(null,"ERROR AL INSERTAR EL REGISTRO
}
this.Instruccion.executeUpdate(this.SentenciaSQL);
JOptionPane.showMessageDialog(null,"EL REGISTRO SE MODIFICO CON EX
}
catch (SQLException SQLE)
{
JOptionPane.showMessageDialog(null,"ERROR AL MODIFICAR EL REGISTRO
}
}
public void DeleteEliminar(String SentenciaSQL)
{
this.SentenciaSQL = SentenciaSQL;
try
{
this.Instruccion.executeUpdate(this.SentenciaSQL);
JOptionPane.showMessageDialog(null,"EL REGISTRO SE ELIMINO CON EXI
}
catch (SQLException SQLE)
{
JOptionPane.showMessageDialog(null,"ERROR AL ELIMINAR EL REGISTRO
}
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
this.Resultado = Instruccion.executeQuery(this.SentenciaSQL);
while(Resultado.next())
{
REGISTRO[0] = Resultado.getString("Id_cancion");
REGISTRO[1] = Resultado.getString("Nombre");
REGISTRO[2] = Resultado.getString("Autor");
REGISTRO[3] = Resultado.getString("Album");
TABLA.addRow(REGISTRO);
}
catch (SQLException SQLE)
{
JOptionPane.showMessageDialog(null,"ERROR AL CARGAR LOS DATOS DE L
}
return TABLA;
}
Imgenes de la Interfaz de la
aplicacin de ejemplo