public Image GetImagePro(int codPro)
        {
            string sql    = "";
            Image  Imagem = null;

            try
            {
                sql = "SELECT ImagProd FROM PRODUTO where ProdutoId = " + codPro;
                SqlCeConnection conexao = new SqlCeConnection(Funcoes.Busca_Conexao());
                SqlCeCommand    cmd     = new SqlCeCommand(sql, conexao);
                conexao.Open();
                SqlCeDataReader rd = cmd.ExecuteReader();

                while (rd.Read())
                {
                    if (!string.IsNullOrEmpty(rd.GetValue(0).ToString()))
                    {
                        Imagem = Funcoes.GetImage((byte[])rd.GetValue(0));
                    }
                }

                conexao.Close();

                return(Imagem);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        public Image GetLogo(int codEmp)
        {
            string sql     = "";
            Image  LogoEmp = null;

            try
            {
                sql = "SELECT logoEmp FROM EMPRESA where EmpresaId = " + codEmp;
                SqlCeConnection conexao = new SqlCeConnection(Funcoes.Busca_Conexao());
                SqlCeCommand    cmd     = new SqlCeCommand(sql, conexao);
                conexao.Open();
                SqlCeDataReader rd = cmd.ExecuteReader();

                while (rd.Read())
                {
                    if (!string.IsNullOrEmpty(rd.GetValue(0).ToString()))
                    {
                        LogoEmp = Funcoes.GetImage((byte[])rd.GetValue(0));
                    }
                }

                conexao.Close();

                return(LogoEmp);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }