徐州工程学院软件项目设计 1 文档
//conn = dbhelper.getConnection();...........................................................................................10
///PreparedStatement pstmt=conn.prepareStatement(stusql);....................................................10
// t.setText(stuId);.......................................................................................................................10
// pstmt.setString(1,"RoomNum");............................................................................................10
// ResultSet rs=pstmt.executeQuery();.......................................................................................10
....................................................................................................................................................10
// String roomNum=rs.getString("RoomNum");.......................................................................10
....................................................................................................................................................10
String sql="select RoomNum,Scord,Suggestion from MakeScord where
RoomNum='"+f3().get(0)+"'";....................................................................................................10
Connection conn=dbhelper.getConnection();............................................................................10
//PreparedStatement pstmt=conn.prepareStatement(sql);..........................................................10
//ResultSet rs=pstmt.executeQuery();........................................................................................10
PreparedStatement ps=conn.prepareStatement(sql);.................................................................10
ResultSet r=ps.executeQuery();.................................................................................................10
while(r.next()){..........................................................................................................................10
String title=r.getString("RoomNum");.......................................................................................10
String date=r.getString("Scord");...............................................................................................10
String anContent=r.getString("Suggestion");............................................................................10
MakeScord a=new MakeScord(title,date,anContent);...............................................................10
dList.add(a);...............................................................................................................................10
}.................................................................................................................................................10
....................................................................................................................................................10
conn.close();...............................................................................................................................11
.....................................................................................................................................................11
}catch(Exception e){..................................................................................................................11
System.out.println(e.getMessage());..........................................................................................11
}..................................................................................................................................................11
return dList;................................................................................................................................11
}..................................................................................................................................................11
4.3 公寓报修功能.......................................................................................................................11
.....................................................................................................................................................11
操作说明:.................................................................................................................................11
实现代码:.................................................................................................................................11
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {...............................11
// TODO add your handling code here:......................................................................................11
.....................................................................................................................................................11
String suShe=txtSuShe.getText();..............................................................................................11
String season=txtSeason.getText();............................................................................................11
try{.............................................................................................................................................11
String sql="insert into RepairRecord(RoomNum,Season)values(?,?)";....................................11
Connection conn=dbhelper.getConnection();............................................................................11
PreparedStatement pstmt=conn.prepareStatement(sql);............................................................11
.....................................................................................................................................................11
pstmt.setString(1,suShe);...........................................................................................................12
pstmt.setString(2, season);.........................................................................................................12
pstmt.executeUpdate();..............................................................................................................12
System.out.println("报修成功");...............................................................................................12
....................................................................................................................................................12
conn.close();...............................................................................................................................12
III