//Get All Users from the local database table public List <RemoteUser> getAllRemoteUsers() { this.connect(); List <RemoteUser> usersList = new List <RemoteUser>(); String query = "Select * from " + TABLE_NAME; SqlCeCommand cmd = new SqlCeCommand(query, this.conn); SqlCeDataReader sqlReader = cmd.ExecuteReader(); while (sqlReader.Read()) { RemoteUser rUser = new RemoteUser(); if (!DBNull.Value.Equals(sqlReader[0])) { rUser.setID(sqlReader.GetInt32(0)); } if (!DBNull.Value.Equals(sqlReader[1])) { rUser.setSystemName(sqlReader.GetString(1)); } if (!DBNull.Value.Equals(sqlReader[2])) { rUser.setUsername(sqlReader.GetString(2)); } if (!DBNull.Value.Equals(sqlReader[3])) { rUser.setPassword(sqlReader.GetString(3)); } if (!DBNull.Value.Equals(sqlReader[4])) { rUser.setModifiedDate(sqlReader.GetDateTime(4)); } if (!DBNull.Value.Equals(sqlReader[5])) { rUser.setStatus(sqlReader.GetString(5)); } usersList.Add(rUser); } this.disconnect(); return(usersList); }
//Get All Users from the local database table public List<RemoteUser> getAllRemoteUsers() { this.connect(); List<RemoteUser> usersList = new List<RemoteUser>(); String query = "Select * from " + TABLE_NAME; SqlCeCommand cmd = new SqlCeCommand(query,this.conn); SqlCeDataReader sqlReader = cmd.ExecuteReader(); while(sqlReader.Read()) { RemoteUser rUser = new RemoteUser(); if (!DBNull.Value.Equals(sqlReader[0])) rUser.setID(sqlReader.GetInt32(0)); if (!DBNull.Value.Equals(sqlReader[1])) rUser.setSystemName(sqlReader.GetString(1)); if (!DBNull.Value.Equals(sqlReader[2])) rUser.setUsername(sqlReader.GetString(2)); if (!DBNull.Value.Equals(sqlReader[3])) rUser.setPassword(sqlReader.GetString(3)); if(! DBNull.Value.Equals(sqlReader[4])) rUser.setModifiedDate(sqlReader.GetDateTime(4)); if (!DBNull.Value.Equals(sqlReader[5])) rUser.setStatus(sqlReader.GetString(5)); usersList.Add(rUser); } this.disconnect(); return usersList; }