-1

I have a webservice that gets a list of byte[] from the db. I want to be able to return all the values. How do I return a byte[].

 [WebMethod]
        public List<fgrTemplate> StudentVerifications()
         {
            List<fgrTemplate> listOfFgrTemp = new List<fgrTemplate>();
            cn.Open();
            SqlCommand com = new SqlCommand("SELECT Template FROM tblFingerprint", cn);
            SqlDataReader sr = com.ExecuteReader();
            while (sr.Read())
            {
                fgrTemplate fingerprint = new fgrTemplate()
                {
                    ID = sr.GetInt32(0),
                    StudentID = sr.GetInt32(1),
                    Description = sr.GetString(2)
                    Template = sr.GetByte??
                };
 listOfFgrTemp.Add(fingerprint);
  }

            cn.Close();
            return listOfFgrTemp;

        }

1 Answers1

1

Like this:

Template = (byte[])sr[3];

OR

Template = (byte[])sr["Template"];
Rick S
  • 6,476
  • 5
  • 29
  • 43
  • thanks this worked but when i tried to run my application m_storedtemplate is returning null value. fgrTemplate[] m_StoredTemplate = verify.StudentVerifications(); – user3284789 Mar 12 '14 at 17:16