this.sNum = num;
sql = \+Integer.parseInt(sNum)+\; try{
DB.OpenConn();
DB.executeUpdate(sql);
JOptionPane.showMessageDialog(null,\成功删除一纪录!\); }
catch(Exception e){
System.out.println(e);
JOptionPane.showMessageDialog(null, \删除失败\, \错误\, JOptionPane.ERROR_MESSAGE); }
finally {
DB.closeStmt(); DB.closeConn(); } }
// 根据球队号查询球队信息
public String[] stuSearch(String num){
Database DB = new Database(); this.sNum = num;
String[] s = new String[5];
if(sNum == null||sNum.equals(\)){
JOptionPane.showMessageDialog(null, \请输入球队号!\, \错误\, JOptionPane.ERROR_MESSAGE); }
sql = \+Integer.parseInt(sNum)+\; try{
DB.OpenConn();
rs = DB.executeQuery(sql); if(rs.next()){
s[0] = rs.getString(\); }
else{
s = null; } }
catch(Exception e){} finally {
DB.closeStmt();
12
DB.closeConn(); }
return s; }
// 修改球队积分信息
public void stuModify1(String num, String score){
Database DB = new Database(); this.sNum = num; this.sScore = score;
sql = \+sNum+\+sScore+\\+Integer.parseInt(sNum)+\; try{
DB.OpenConn();
DB.executeUpdate(sql);
JOptionPane.showMessageDialog(null,\成功修改一条新的纪录!\); }
catch(Exception e){
System.out.println(e);
JOptionPane.showMessageDialog(null, \更新失败\, \错误\, JOptionPane.ERROR_MESSAGE); }
finally {
DB.closeStmt(); DB.closeConn(); } }
//根据球队号查询球队积分信息
public String[] stuSearch1(String num){
Database DB = new Database(); this.sNum = num;
String[] s = new String[5];
if(sNum == null||sNum.equals(\)){
JOptionPane.showMessageDialog(null, \请输入球队号!\, \错误\, JOptionPane.ERROR_MESSAGE); }
sql = \+Integer.parseInt(sNum)+\; try{
DB.OpenConn();
13
rs = DB.executeQuery(sql); if(rs.next()){
s[0] = rs.getString(\); } else{
s = null; } }
catch(Exception e){} finally {
DB.closeStmt(); DB.closeConn(); }
return s; }
//删除积分信息
public void stuDel1(String num){
Database DB = new Database(); this.sNum = num;
sql = \+Integer.parseInt(sNum)+\; try{
DB.OpenConn();
DB.executeUpdate(sql);
JOptionPane.showMessageDialog(null,\成功删除一纪录!\); }
catch(Exception e){
System.out.println(e);
JOptionPane.showMessageDialog(null, \删除失败\, \错误\, JOptionPane.ERROR_MESSAGE); }
finally {
DB.closeStmt(); DB.closeConn(); } }
//添加球队积分信息
public void stuAdd1(String num, String score) {
14
Database DB = new Database(); this.sNum = num; this.sScore = score;
if(sNum == null||sNum.equals(\)){
JOptionPane.showMessageDialog(null, \请输入球队号!\, \错误\, JOptionPane.ERROR_MESSAGE); return; }
else if(sScore == null||sScore.equals(\)){
JOptionPane.showMessageDialog(null, \请输入球队积分!\, \错误\, JOptionPane.ERROR_MESSAGE); return; }
else{
sql = \+sNum+\+sScore+\; try{
DB.OpenConn();
DB.executeUpdate(sql);
JOptionPane.showMessageDialog(null,\成功添加一条新的纪录!\); }
catch(Exception e){
System.out.println(e);
JOptionPane.showMessageDialog(null, \保存失败\, \错误\, JOptionPane.ERROR_MESSAGE); }
finally {
DB.closeStmt(); DB.closeConn(); } } } }
15
相关推荐: