⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatepersonalinformation.java

📁 我用JAVA写的QQ程序
💻 JAVA
字号:
/*
 * UpdataPersonalInformation.java
 *
 * Created on 2007年5月2日, 下午2:38
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package 服务器端程序包;
import java.sql.*;
/**
 *
 * @author 王绿春  南昌大学软件学院045班
 */
public class UpdatePersonalInformation {
    SQLServerDatabase DataBase=null;
    String QQNumber=null;
    String QQPassword=null;
    String NickName=null;
    String TrueName=null;
    String Sex=null;
    String Age=null;
    String LeavingInformation=null;
    String Icon=null;
    String Sign=null;
    String FriendList=null;
    String OnlineTime=null;
    String RequestList=null;
    String ResponseList=null;
    String GroupList=null;
    String MyGroup=null;
    String Message=null;
    String GroupLeavingMessage=null;
    String sql=null;
    /** Creates a new instance of UpdataPersonalInformation */
    public UpdatePersonalInformation(){
        try 
       {
            DataBase=new SQLServerDatabase();
       } 
       catch (SQLException ex) 
       {
            ex.printStackTrace();
       } 
       catch (ClassNotFoundException ex) 
      {
             ex.printStackTrace();
       }
    }
    public UpdatePersonalInformation(String QQNum,String NicNam,String TruNam,String Se,String Ag,String Ico,String Sig) 
    {
        QQNumber=QQNum;
        NickName=NicNam;
        TrueName=TruNam;
        Sex=Se;
        Age=Ag;
        Icon=Ico;
        Sign=Sig;
        
        try 
       {
            DataBase=new SQLServerDatabase();
       } 
       catch (SQLException ex) 
       {
            ex.printStackTrace();
       } 
       catch (ClassNotFoundException ex) 
      {
             ex.printStackTrace();
       }
    }
    public UpdatePersonalInformation(String QQNum,String QQPass)
    {
        QQNumber=QQNum;
        QQPassword=QQPass;
        sql="update QQClientInformation  set QQPassword='"+QQPassword+"'"+"where QQNumber='"+QQNumber+"'";
         try 
       {
            DataBase=new SQLServerDatabase();
       } 
       catch (SQLException ex) 
       {
            ex.printStackTrace();
       } 
       catch (ClassNotFoundException ex) 
      {
             ex.printStackTrace();
       }
    }
    public UpdatePersonalInformation(String QQNum ,String column,String addition){
        QQNumber=QQNum;
        
        try 
       {    
            String sql0="select * from QQClientInformation  where QQNumber='"+QQNumber+"'";
            DataBase=new SQLServerDatabase();
            ResultSet ResultData=DataBase.ExecuteSelect(sql0);
            
            System.out.println("执行选择语句成功");
            
            ResultData.next();
            String Old=ResultData.getString(column);
            String New=null;
            
            if(column.equals("FriendList")){
                if(addition.startsWith("@")){
                    New=addition.substring(1);
                }
                else{
                    New=Old+addition+"#";
                }
                System.out.println("不生气啊 乖!");
            }
            else if(addition.equals("@")){
                New="@";
            }
            else{
                 New=Old+addition+"$";
            }
            
            sql="update QQClientInformation set "+column+"='"+New+"'"+"where QQNumber='"+QQNumber+"'";
       } 
        catch (SQLException ex) 
       {
            ex.printStackTrace();
       } 
       catch (ClassNotFoundException ex) 
      {
             ex.printStackTrace();
       }
    }
    public UpdatePersonalInformation(String QQNum,String QQPass,String NicNam,String TruNam,String Se,String Ag,String Leaving,String Ic,String Sig,String FrList,String OnlTime,String RequList,String RespList,String GroList,String MyGrou,String Messag,String GroupLeavingMessag)
    {
         QQNumber=QQNum;
         QQPassword=QQPass;
         NickName=NicNam;
         TrueName=TruNam;
         Sex=Se;
         Age=Ag;
         LeavingInformation=Leaving;
         Icon=Ic;
         Sign=Sig;
         FriendList=FrList;
         OnlineTime=OnlTime;
         RequestList=RequList;
         ResponseList=RespList;
         GroupList=GroList;
         MyGroup=MyGrou;
         Message=Messag;
         GroupLeavingMessage=GroupLeavingMessag;
         sql="insert into QQClientInformation values('"+QQNumber+"','"+QQPassword+"','"+NickName+"','"+TrueName+"','"+Sex+"','"+Age+"','"+LeavingInformation+"','"+Icon+"','"+Sign+"','"+FriendList+"','"+OnlineTime+"','"+RequestList+"','"+ResponseList+"','"+GroupList+"','"+MyGroup+"','"+Message+"','"+GroupLeavingMessage+"')";
         try 
       {
            DataBase=new SQLServerDatabase();
       } 
       catch (SQLException ex) 
       {
            ex.printStackTrace();
            
       } 
       catch (ClassNotFoundException ex) 
      {
             ex.printStackTrace();
       }
    }
  
    public boolean Update()
    {
        boolean Successfull=true;
        
        try {
            DataBase.executeDML(sql);
        } catch (SQLException ex) {
            ex.printStackTrace();
            Successfull=false;
        }
        return Successfull; 
    }
    public boolean Insert()
    {
        boolean IsSuccessfull=true;
        
        try {
            DataBase.executeDML(sql);
        } catch (SQLException ex) {
            //ex.printStackTrace();
            IsSuccessfull=false;
            return IsSuccessfull; 
        }
        return IsSuccessfull; 
    }
    
   public boolean UpdatePersonalInfo(){
       boolean IsSuccessfull=true;
       //sql="update QQClientInformation set "+column+"='"+New+"'"+"where QQNumber='"+QQNumber+"'";
       
       String sql1="update QQClientInformation set NickName='"+NickName+"'"+"where QQNumber='"+QQNumber+"'";
       
       String sql2="update QQClientInformation  set TrueName='"+TrueName+"'"+"where QQNumber='"+QQNumber+"'";
       String sql3="update QQClientInformation  set Sex='"+Sex+"'"+"where QQNumber='"+QQNumber+"'";
       String sql4="update QQClientInformation  set Age='"+Age+"'"+"where QQNumber='"+QQNumber+"'";
       String sql5="update QQClientInformation  set Icon='"+Icon+"'"+"where QQNumber='"+QQNumber+"'";
       String sql6="update QQClientInformation  set Sign='"+Sign+"'"+"where QQNumber='"+QQNumber+"'";
       System.out.println("运行到了这里~ _~");
       try {
            DataBase.executeDML(sql1);
            DataBase.executeDML(sql2);
            DataBase.executeDML(sql3);
            DataBase.executeDML(sql4);
            DataBase.executeDML(sql5);
            DataBase.executeDML(sql6);
            System.out.println("也运行到了这里~ _~");
            
        } catch (SQLException ex) {
            ex.printStackTrace();
            IsSuccessfull=false;
            return IsSuccessfull; 
        }
        return IsSuccessfull; 
   }
   public ResultSet QueryMember() throws SQLException, ClassNotFoundException{
       String sql="select QQNumber,NickName from QQClientInformation";
       ResultSet ResultData=null;
       DataBase=new SQLServerDatabase();
       ResultData=DataBase.ExecuteSelect(sql);
       return  ResultData;
   }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -