//将所有的id信息放到infolist 返回到客户端的信息 private List <Object> SaveClientInfoToList(List <Object> infolist) { string selectStr = "select name,ip,port,islogin from IDInfo"; DBDeal dbDeal = new DBDeal(); SqlDataReader sdr = dbDeal.SqlGetThreeInfo(selectStr); while (sdr.Read()) { infolist.Add(sdr[0].ToString()); //name infolist.Add(sdr[1].ToString()); //ip infolist.Add(sdr[2].ToString()); //port infolist.Add(sdr[3].ToString()); //islogin } dbDeal.ShutDown(); return(infolist); }
//根据ip port获取信息 (22) private List <Object> GetUserInfo(List <Object> temp, List <Object> infolist) { string selectStr = String.Format("select * from IDInfo where ip='{0}' and port='{1}'", temp[0].ToString(), temp[1].ToString()); DBDeal dbDeal = new DBDeal(); SqlDataReader sdr = dbDeal.SqlGetThreeInfo(selectStr); sdr.Read(); infolist.Add(sdr[0].ToString()); //id infolist.Add(sdr[1].ToString()); //ip infolist.Add(sdr[2].ToString()); //port //infolist.Add(sdr[3].ToString());//pwd infolist.Add(sdr[4].ToString()); //name infolist.Add(sdr[5].ToString()); //sex infolist.Add(sdr[6].ToString()); //lastlogindate infolist.Add(sdr[7].ToString()); //islogin infolist.Add(sdr[8].ToString()); //other dbDeal.ShutDown(); return(infolist); }