Ejemplo n.º 1
0
 public Types.DepartamentosType select()
 {
     MySqlConnection con = new MySqlConnection(Dados.StringConexao);
     string SQL = "SELECT * FROM DEPARTAMENTO";
     MySqlCommand cmd = new MySqlCommand(SQL, con);
     con.Open();
     MySqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
     Types.DepartamentosType types = new Types.DepartamentosType();
     while (dr.Read())
     {
         Types.DepartamentoType type = new Types.DepartamentoType();
         type.Descricao = dr["DESCRICAO"].ToString();
         type.IdDepartamento = Int32.Parse(dr["ID_DEPARTAMENTO"].ToString());
         types.Add(type);
     }
     return types;
 }
Ejemplo n.º 2
0
        public Types.DepartamentosType select()
        {
            MySqlConnection con = new MySqlConnection(Dados.StringConexao);
            string          SQL = "SELECT * FROM DEPARTAMENTO";
            MySqlCommand    cmd = new MySqlCommand(SQL, con);

            con.Open();
            MySqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            Types.DepartamentosType types = new Types.DepartamentosType();
            while (dr.Read())
            {
                Types.DepartamentoType type = new Types.DepartamentoType();
                type.Descricao      = dr["DESCRICAO"].ToString();
                type.IdDepartamento = Int32.Parse(dr["ID_DEPARTAMENTO"].ToString());
                types.Add(type);
            }
            return(types);
        }