Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
     public bool SelectEmployee()
        {



            bool blnExist = false;
            SqlDataReader dr = SqlHelper.ExecuteReader(gstrCnn, "sp_Employee_SelectRow");
            while (dr.Read())
            {

                _IdEmployee = Convert.ToInt32(dr[0]);
                CodEmployee = dr[1].ToString();
                Name = dr[2].ToString();
               LastName = dr[3].ToString();
                DateStart = Convert.ToDateTime(dr[4]);
                State = Convert.ToBoolean(dr[5]);
                IdSociety= Convert.ToInt32(dr[6]);
                IdEmployeeCharge = Convert.ToInt32(dr[7]);
                EmployeePicture = (dr[8]);
                gstrUserName = dr[9].ToString();



                blnExist = true;
            }
            return blnExist;

}
         #Region

        private int _IdEmployee;
          public int IdEmployee
            {
              get
              {
                 return _IdEmployee;
              }
            }

        
        public string CodEmployee { get; set; }
        public string Name { get; set; }
        public string LastName { get; set; }
        public DateTime DateStart { get; set; }
        public bool State { get; set; }
        public int IdSociety{ get; set; }
        public int IdEmployeeCharge { get; set; }
        public PictureBox FotoServidor { get; set; }

        #endregion


        }
Posted
Comments
Richard MacCutchan 6-Dec-13 13:01pm    
What error?
Sergey Alexandrovich Kryukov 6-Dec-13 14:05pm    
Image cannot be "converted" to "type PictureBox", just because PictureBox is merely a control using image as its property. This way, the question makes no sense. What is the problem?
—SA

1 solution

Try:
C#
MemoryStream ms = new MemoryStream((byte[]) dr[8]);
EmployeePicture.Image = Image.FromStream(ms);
 
Share this answer
 
Comments
idoug12 7-Dec-13 11:09am    
Thank you for all responses, I resolved this error by another method..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900