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

📄 dmlgroups.java

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

package 服务器端程序包;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author 张金凤  软件046班  8000104219
 */
public class DMLGroups {

    private SQLServerDatabase DataBase;
    private String QQNumber;
    private String GroupNumber;
    private String Icon;
    private String GroupMember;
    /** Creates a new instance of DMLGroups */
    public DMLGroups() {
        
        try 
       {
            DataBase=new SQLServerDatabase();
       } 
       catch (SQLException ex) 
       {
            ex.printStackTrace();
       } 
       catch (ClassNotFoundException ex) 
      {
             ex.printStackTrace();
       }
    }
    public DMLGroups(String GroupNum,String Ico,String GroupMem,String QQNum){
        GroupNumber=GroupNum;
        Icon=Ico;
        GroupMember=GroupMem;
        QQNumber=QQNum;
        try 
       {
            DataBase=new SQLServerDatabase();
       } 
       catch (SQLException ex) 
       {
            ex.printStackTrace();
       } 
       catch (ClassNotFoundException ex) 
      {
             ex.printStackTrace();
       }
    }
    public boolean Insert(){
       boolean IsSuccessful=false;
       String Messages="@";
       String sql="insert into Groups values('"+GroupNumber+"','"+GroupMember+"','"+Messages+"','"+Icon+"','"+QQNumber+"')";
        try {
            DataBase.executeDML(sql);
            IsSuccessful=true;
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return IsSuccessful;
    }
    public boolean Append(String GroupNum,String Column,String addition) throws SQLException{
        boolean IsSuccessful=false;
        GroupNumber=GroupNum;
        String sql="select * from Groups  where GroupNumbers='"+GroupNumber+"'";
        ResultSet ResultData=DataBase.ExecuteSelect(sql);
        if(ResultData.next()){
            String Old=ResultData.getString(Column);
            String New=Old+addition+"#";
            String sql0="update Groups set "+Column+"='"+New+"'"+"where GroupNumbers='"+GroupNumber+"'";
            try {
               DataBase.executeDML(sql0);
               IsSuccessful=true;
            } catch (SQLException ex) {
               ex.printStackTrace();
              }
        }
        return IsSuccessful;
    }
    public boolean Update(String GroupNum,String Column,String Newvalue){
        boolean IsSuccessful=false;
        GroupNumber=GroupNum;
        String sql="update Groups set "+Column+"='"+Newvalue+"'"+"where GroupNumber='"+GroupNumber+"'";
        try {
               DataBase.executeDML(sql);
               IsSuccessful=true;
            } catch (SQLException ex) {
               ex.printStackTrace();
              }
        return IsSuccessful;
    }
    public String  Query(String GroupNum,String Column){
        GroupNumber=GroupNum;
        String Member=null;
        String sql="select * from Groups  where GroupNumbers='"+GroupNumber+"'";
        try {
               ResultSet ResultData=DataBase.ExecuteSelect(sql);
               if(ResultData.next()){
                  Member=ResultData.getString(Column);
               }
            } catch (SQLException ex) {
               ex.printStackTrace();
              }
        return Member;
    }
}    

⌨️ 快捷键说明

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