示例#1
0
        public ImageTable[] GetImages()
        {
            ImageTable[]  Images = null;
            SqlConnection Conn   = new SqlConnection("Data Source=.;Initial Catalog=Company;Integrated Security=SSPI");

            Conn.Open();
            SqlCommand    Cmd    = new SqlCommand("Select * From ImageTable", Conn);
            SqlDataReader Reader = Cmd.ExecuteReader();
            DataTable     dt     = new DataTable();

            dt.Load(Reader);
            Images = new ImageTable[dt.Rows.Count];
            int i = 0;

            foreach (DataRow Dr in dt.Rows)
            {
                Images[i] = new ImageTable()
                {
                    ImadeId = Convert.ToInt32(Dr["ImageId"]),
                    Image   = (byte[])Dr["Image"]
                };
                i = i + 1;
            }
            Conn.Close();
            return(Images);
        }
示例#2
0
 public ImageTable[] GetImages()
 {
     ImageTable[] Images = null;
     SqlConnection Conn = new SqlConnection("Data Source=.;Initial Catalog=Company;Integrated Security=SSPI");
     Conn.Open();
     SqlCommand Cmd = new SqlCommand("Select * From ImageTable", Conn);
     SqlDataReader Reader = Cmd.ExecuteReader();
     DataTable dt = new DataTable();
     dt.Load(Reader);
     Images = new ImageTable[dt.Rows.Count];
     int i = 0;
     foreach (DataRow Dr in dt.Rows)
     {
         Images[i] = new ImageTable()
         {
              ImadeId = Convert.ToInt32(Dr["ImageId"]),
               Image = (byte[])Dr["Image"]
         };
         i = i + 1;
     }
     Conn.Close();
     return Images;
 }