当前位置: 首页>>代码示例>>Java>>正文


Java DbUtils类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:robert-andama,项目名称:student-result-system-in-Java-OOP,代码行数:25,代码来源:Lecturer.java

示例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) {                
       }        
        

    }
 
开发者ID:gnoopy,项目名称:wifepos,代码行数:27,代码来源:JMooringDetails.java

示例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();
        }
}
 
开发者ID:txtbits,项目名称:aseguradora-dbs,代码行数:24,代码来源:Hospital.java

示例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();
        }
}
 
开发者ID:txtbits,项目名称:aseguradora-dbs,代码行数:24,代码来源:Medico.java

示例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();
        }
}
 
开发者ID:txtbits,项目名称:aseguradora-dbs,代码行数:24,代码来源:Asegurado.java

示例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();
        }
}
 
开发者ID:txtbits,项目名称:aseguradora-dbs,代码行数:24,代码来源:Poliza.java

示例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);
		}

	}
 
开发者ID:digital-india-solution,项目名称:HospitalManagementSystem,代码行数:19,代码来源:Doctor_page.java

示例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);
        
    }


}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:16,代码来源:UI.java

示例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);
    }
}
 
开发者ID:GroupKT,项目名称:GroupK,代码行数:11,代码来源:UPDATE.java

示例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);

}
 
开发者ID:YasasshraSolutions,项目名称:Java-Air-Reservation,代码行数:13,代码来源:ManageFlightLeg.java

示例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));

}
 
开发者ID:YasasshraSolutions,项目名称:Java-Air-Reservation,代码行数:13,代码来源:Managecustomer.java

示例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));

}
 
开发者ID:YasasshraSolutions,项目名称:Java-Air-Reservation,代码行数:13,代码来源:Managetickets.java

示例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));

}
 
开发者ID:YasasshraSolutions,项目名称:Java-Air-Reservation,代码行数:10,代码来源:Managetickets.java

示例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);

}
 
开发者ID:YasasshraSolutions,项目名称:Java-Air-Reservation,代码行数:16,代码来源:ManageAirport.java

示例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);
}
 
开发者ID:YasasshraSolutions,项目名称:Java-Air-Reservation,代码行数:12,代码来源:Manageflights.java


注:本文中的net.proteanit.sql.DbUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。