本文整理汇总了Java中net.proteanit.sql.DbUtils类的典型用法代码示例。如果您正苦于以下问题:Java DbUtils类的具体用法?Java DbUtils怎么用?Java DbUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DbUtils类属于net.proteanit.sql包,在下文中一共展示了DbUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jb_resultActionPerformed
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
private void jb_resultActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jb_resultActionPerformed
String cmbitem = (String) jc_units.getSelectedItem();
// sql statment
connect.setSql("SELECT *FROM enroll where course_code='" + cmbitem + "'");
//get result
ResultSet result = connect.getResultSet();
// set data on to table
jt_table.setModel(DbUtils.resultSetToTableModel(result));
// sql statment
connect.setSql("SELECT * FROM enroll WHERE course_code = '" + cmbitem + "'");
//get result
ResultSet result_enroll = connect.getResultSet();
try {
// set data on to fileds
while (result_enroll.next()) {
jf_id.setText((result_enroll.getString("Regno")));
jf_unit.setText(result_enroll.getString("courseUnit"));
jt_marks.setText(result_enroll.getString("marks"));
jt_grade.setText(result_enroll.getString("grade"));
}
} catch (SQLException ex) {
Logger.getLogger(Lecturer.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例2: init
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
private void init(Session s) {
initComponents();
setTitle("Select Vessel details");
try{
con=s.getConnection();
stmt = (Statement) con.createStatement();
SQL = "SELECT * FROM MOORERS";
rs = stmt.executeQuery(SQL);
jTableSelector.setModel(DbUtils.resultSetToTableModel(rs));
jTableSelector.getColumnModel().getColumn(0).setPreferredWidth(200);
jTableSelector.getColumnModel().getColumn(1).setPreferredWidth(40);
jTableSelector.getColumnModel().getColumn(2).setPreferredWidth(40);
jTableSelector.getColumnModel().getColumn(3).setPreferredWidth(40);
jTableSelector.setRowSelectionAllowed(true);
jTableSelector.getTableHeader().setReorderingAllowed(true);
} catch (Exception e) {
}
}
示例3: buscarHospital
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
private void buscarHospital(String nombre) {
try {
String sql = "select * from hospital where upper(N_H) LIKE ?";
PreparedStatement prst = conection.createStatement(sql);
prst.setString(1, "%"+nombre.toUpperCase()+"%");
ResultSet rsst = prst.executeQuery();
tablaHospital.setModel(DbUtils.resultSetToTableModel(rsst));
if (rsst != null && rsst.next()){
rsst.beforeFirst();
tablaHospital.setModel(DbUtils.resultSetToTableModel(rsst));
}
else if (!rsst.first()){
JOptionPane.showMessageDialog(null,
"No hay resultados para su búsqueda",
"Información",
JOptionPane.ERROR_MESSAGE);
cargarHospital();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
示例4: buscarMedico
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
private void buscarMedico(String nombre) {
try {
String sql = "select * from medico where upper(N_M) LIKE ?";
PreparedStatement prst = conection.createStatement(sql);
prst.setString(1, "%"+nombre.toUpperCase()+"%");
ResultSet rsst = prst.executeQuery();
tablaMedico.setModel(DbUtils.resultSetToTableModel(rsst));
if (rsst != null && rsst.next()){
rsst.beforeFirst();
tablaMedico.setModel(DbUtils.resultSetToTableModel(rsst));
}
else if (!rsst.first()){
JOptionPane.showMessageDialog(null,
"No hay resultados para su búsqueda",
"Información",
JOptionPane.ERROR_MESSAGE);
cargarMedico();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
示例5: buscarAsegurado
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
private void buscarAsegurado(String nombre) {
try {
String sql = "select * from asegurado where upper(NA) LIKE ?";
PreparedStatement prst = conection.createStatement(sql);
prst.setString(1, "%"+nombre.toUpperCase()+"%");
ResultSet rsst = prst.executeQuery();
tablaAsegurado.setModel(DbUtils.resultSetToTableModel(rsst));
if (rsst != null && rsst.next()){
rsst.beforeFirst();
tablaAsegurado.setModel(DbUtils.resultSetToTableModel(rsst));
}
else if (!rsst.first()){
JOptionPane.showMessageDialog(null,
"No hay resultados para su búsqueda",
"Información",
JOptionPane.ERROR_MESSAGE);
cargarAsegurado();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
示例6: buscarPoliza
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
private void buscarPoliza(String nombre) {
try {
String sql = "select * from poliza where upper(DATOS_P) LIKE ?";
PreparedStatement prst = conection.createStatement(sql);
prst.setString(1, "%"+nombre.toUpperCase()+"%");
ResultSet rsst = prst.executeQuery();
tablaPoliza.setModel(DbUtils.resultSetToTableModel(rsst));
if (rsst != null && rsst.next()){
rsst.beforeFirst();
tablaPoliza.setModel(DbUtils.resultSetToTableModel(rsst));
}
else if (!rsst.first()){
JOptionPane.showMessageDialog(null,
"No hay resultados para su búsqueda",
"Información",
JOptionPane.ERROR_MESSAGE);
cargarPoliza();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
示例7: updateTable
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
public void updateTable() {
Connection conn = DbConnection.dbConnector();
try {
String sql = "select * from medi";
PreparedStatement pst = conn.prepareStatement(sql);
ResultSet rs = pst.executeQuery();
table.setModel(DbUtils.resultSetToTableModel(rs));
pst.close();
rs.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}
示例8: showTableData
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
public void showTableData(){
try{
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/slit?autoReconnect=true&useSSL=false","root","root");
String sql = "SELECT * FROM user";
pst = con.prepareStatement(sql);
rs=pst.executeQuery();
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}
catch(Exception ex){
JOptionPane.showMessageDialog(null, ex);
}
}
示例9: LoadData
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
public static void LoadData (String sql,JTable tb) {
try{
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
tb.setModel((DbUtils.resultSetToTableModel(rs)));
}
catch(Exception e) {
JOptionPane.showMessageDialog(null, e ,"Thông báo lỗi",1);
}
}
示例10: tableload
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
private void tableload() {
FlightLeg fl = new FlightLeg();
ResultSet rs = fl.getAll();
if (rs == null) {
return;
}
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
//set bg colour
jTable1.setBackground(Color.yellow);
}
示例11: tableload
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
/**
* table load function
*/
private void tableload() {
Passenger p1 = new Passenger();
ResultSet rs = p1.getAll();
if (rs == null) {
return;
}
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}
示例12: tableload
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
/**
* table load function
*/
private void tableload() {
Tickets t1 = new Tickets();
ResultSet rs = t1.getAll();
if (rs == null) {
return;
}
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}
示例13: tableload2
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
private void tableload2(FlightLeg ft) {
Tickets t1 = new Tickets();
ResultSet rs = t1.getforleg(ft.getLeg_no());
if (rs == null) {
return;
}
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}
示例14: tableload
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
/**
* Genarate data for jtable
*/
private void tableload() {
Airport airPorts = new Airport();
ResultSet rs = airPorts.getAll();
if (rs == null) {
return;
}
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
//set bg colour
jTable1.setBackground(Color.yellow);
}
示例15: tableload
import net.proteanit.sql.DbUtils; //导入依赖的package包/类
private void tableload() {
Flight flights = new Flight();
ResultSet rs = flights.getAll();
if (rs == null) {
return;
}
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
//set bg colour
jTable1.setBackground(Color.yellow);
}