¡¶Web¼¼Êõ¡·ÊµÑ鱨¸æ
}
}
stmt = dbc.getConnection().createStatement(); stmt.execute(sql1); stmt.execute(sql2); stmt.execute(sql3); stmt.execute(sql4); stmt.execute(sql5); stmt.close(); dbc.close();
// TODO Auto-generated catch block e.printStackTrace();
} catch (SQLException e) {
ÔÚÕâÀïÊǶÔÓû§µÄÏà¹ØÐÅÏ¢½øÐÐÐ޸ģ¬Ò»¹²ÓÐÎåÌõÐÅÏ¢£¬ËùÒÔÐèÒªÎåÌõsqlÓï¾ä£¬²¢Í¨¹ýÓû§ÃûÀ´¼ìË÷µ½Ïà¹ØµÄ¼Ç¼²¢Ê¹ÓÃStatement¶ÔÏóµÄexecute£¨String sql£©·½·¨À´½øÐÐɾ³ýÊý¾Ý£¬É¾³ýºó¹Ø±ÕStatement¶ÔÏóºÍÊý¾Ý¿âÁ¬½Ó¼´¿É¡£
¢Ü²éѯÊý¾Ý¿âµÄ±í¸ñÖеÄÊý¾ÝµÄ·½·¨¡£
ÔÚÕâÀïÊǶÔuser_information±í½øÐвÙ×÷¡£
public String[] queryinformation(String username){
String sql = \+\DataBaseConnection dbc=null; dbc=new DataBaseConnection(); Statement stmt = null; String information[]=null; String nicheng=\; String age=\; String email=\; String aihaonumber=\; String sex=\; String aihao=\; try {
stmt = dbc.getConnection().createStatement(); ResultSet rs=stmt.executeQuery(sql); rs.next();
nicheng=rs.getString(\); age=rs.getString(\); email=rs.getString(\); aihaonumber=rs.getString(\); sex=rs.getString(\); case '0':aihao=\ÎÞ\
46
name='\+username+\;
/* switch(aihaonumber.charAt(0)){
¡¶Web¼¼Êõ¡·ÊµÑ鱨¸æ
}
}
case '1':aihao=\¿´µçÓ°\ case '2':aihao=\ÁÄÌì\
case '3':aihao=\¿´µçÓ°¡¢ÁÄÌì\ case '4':aihao=\³ª¸è\
case '5':aihao=\¿´µçÓ°¡¢³ª¸è\ case '6':aihao=\ÁÄÌì¡¢³ª¸è\
case '7':aihao=\¿´µçÓ°¡¢ÁÄÌì¡¢³ª¸è\ }
if(sex.equals(\ {
sex=\Å®\
}else sex=\ÄÐ\
information=new String[]{nicheng,age,sex,email,aihaonumber };
rs.close(); stmt.close(); dbc.close();
// TODO Auto-generated catch block e.printStackTrace();
} catch (SQLException e) {
returninformation;
ÔÚÕâÀïÓÃÒ»¸öStringÊý×éÀ´½ÓÊÕ²éѯµ½µÄÐÅÏ¢£¬Ê×Ïȶ¨ÒåÒ»¸ösqlÓï¾ä£¬²¢¸ù¾ÝÏà¹ØµÄÓû§Ãû½øÐмìË÷£¬Óýá¹û¼¯ResultSet¶ÔÏóÀ´½ÓÊÕ²éѯ½á¹û£¬ÀûÓÃResultSet¶ÔÏóµÄget·½·¨¸ù¾Ý±íÍ·À´µÃµ½Ïà¹ØµÄÐÅÏ¢´æ´¢ÔÚStringÊý×éÖзµ»Ø¼´¿É£¬×îºó¹Ø±Õ½á¹û¼¯¡¢Statement¶ÔÏó¡¢Êý¾Ý¿âµÄÁ¬½Ó¡£
¢Ý¼ÆËãÊý¾Ý¿âÖеıí¸ñµÄÖеÄÌõÄ¿µÄÊýÁ¿µÄ·½·¨¡£ ÕâÀïÊǶÔuser±í½øÐвéѯµÄ²Ù×÷¡£
publicint query(){
String sql=\; DataBaseConnection dbc=null; dbc=new DataBaseConnection(); Statement stmt = null; introwCount=0; try {
stmt = dbc.getConnection().createStatement(); ResultSet rs=stmt.executeQuery(sql); rs.last();
rowCount=rs.getRow(); rs.close();
47
Ïà¹ØÍÆ¼ö£º