Professional Documents
Culture Documents
*;
import java.sql.*;
import javax.swing.JOptionPane;
this.setVisible(false);
}
// Before writting the followng line, you should import the line:
// import javax.swing.table.*; at the top of your application
DefaultTableModel model = (DefaultTableModel) jTable3.getModel();
// Clear the existing table
int rows = model.getRowCount();
if (rows > 0) {
for (int i = 0; i < rows; i++) {
model.removeRow(0);
}
}
// SQL Query
String st = "NON"; // Lib table
String query = "SELECT * FROM veh WHERE ISSUE_status = '" +st+ "';";
try {
// Connect to MySQL database
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/travelagency","root","mysq
l");
// Create SQL statement and execute query.
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
new ONBOOK().setVisible(true);
this.setVisible(false); // TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new avilableveh().setVisible(true);
}
});
}