예제 #1
0
        public string SelectEmployees()
        {
            string str = "";

            dbConnection.Close();
            Emploeey row = new Emploeey();

            command             = dbConnection.CreateCommand();
            command.CommandText = "SELECT * FROM Employees";
            command.CommandType = CommandType.Text;
            dbConnection.Open();
            var reader = command.ExecuteReader(CommandBehavior.SingleResult);

            while (reader.Read())
            {
                row.IDEmpl    = reader[0].ToString();
                row.FIO       = reader[1].ToString();
                row.Login     = reader[2].ToString();
                row.IDDep     = reader[3].ToString();
                row.Position  = reader[4].ToString();
                row.PhoneEmpl = reader[5].ToString();
                row.E_mail    = reader[6].ToString();
                str          += reader[0].ToString() + "|" + reader[1].ToString() + "|" + reader[2].ToString() + "|" + reader[3].ToString() + "|" + reader[4].ToString() + "|" + reader[5].ToString() + "|" + reader[6].ToString() + "*";
            }
            return(str.Substring(0, str.Length - 1));
        }
        public Array SelectEmployees()
        {
            dbConnection.Close();
            ArrayList tabl = new ArrayList();
            Emploeey  row  = new Emploeey();

            command             = dbConnection.CreateCommand();
            command.CommandText = "SELECT * FROM Emploeeys";
            command.CommandType = CommandType.Text;
            dbConnection.Open();
            var reader = command.ExecuteReader(CommandBehavior.SingleResult);

            while (reader.Read())
            {
                row.IDEmpl    = reader[0].ToString();
                row.FIO       = reader[1].ToString();
                row.Login     = reader[2].ToString();
                row.IDDep     = reader[3].ToString();
                row.Position  = reader[4].ToString();
                row.PhoneEmpl = reader[5].ToString();
                row.E_mail    = reader[6].ToString();
                tabl.Add(row);
            }
            return(tabl.ToArray());
        }