title: Retrieving images from Database into ArrayList and Displaying it one by one from ArrayList in ASP.NET
body: <p>using following code i store images into ArrayList.</p>
  
  <pre><code>    public ArrayList getImagesToArray(string qry)
      {
  
          ArrayList arr;
          if (myConn.State == System.Data.ConnectionState.Closed)
              myConn.Open();
          if (myDR != null)
              myDR.Close();
          myComm = new SqlCommand(qry, myConn);
  
          using (myComm)
          {
              arr = new ArrayList();
              myDR = myComm.ExecuteReader();
              while (myDR.Read())
              {
                  arr.Add((byte[])myDR[0]);
              }
              return arr;
          }     
      }
  </code></pre>
  
  <p><strong>Now i retreive images to an ArrayList using Following Code</strong></p>
  
  <pre><code>ArrayList arrImgs_Main = Q.getImagesToArray("Select FieldImg from InfoTagQA I INNER JOIN PensionScannedDocs P on p.ScanImageID=i.ScanImageID Where P.PersonalNumber='" + hid_PersonalNo.Value + "'");
  </code></pre>
  
  <p><strong>Now I display image one by one from arrayList to ImageUrl by clicking Next and Previous button</strong></p>
  
  <pre><code>protected void lnk_BackImage_Click(object sender, EventArgs e)
  {    
      try
      {      
          if (arrImgs_Main.Count &gt; 0)
          {        
              if (i &gt; 0)
              {
                  i--;
                  img_mainImage.ImageUrl = "data:image;base64," + Convert.ToBase64String((byte[])arrImgs_Main[i]);
                  lab_TotalRecords.Text = "(" + (i + 1) + "/" + arrImgs_Main.Count + ")";
                  if (i == 0)
                  {
                      lnk_ForwardImage.Visible = true;
                      lnk_BackImage.Visible = false;
                  }
              }         
          }   
      }
      catch(Exception ee)
      {
          ShowErrorMsg(ee.Message);
      }   
  }
  </code></pre>
  
  <p>**All above code works fine and quick on my local machine, but after deployment on server , it take much time in displaying image one by one from array.
  Am i doing doing right in above code or going on wrong way. Please guide me **</p>