Click here to Skip to main content
16,012,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Anyone with help i want to get multiple images from database via business logic and diplay on a gridview when i bind this method with gridview using object datasource, it does not workout.
C#
      public List<vote> get_images()
      {
          csDAL objdal = new csDAL();
          List<vote> objparlist = new List<vote>();
          IDataReader dr = null;
          dr = objdal.executespreturndr("Get_All");
          {
              while (dr.Read())
              {
                  vote objc = new vote();
                  populate_bal(dr, objc);
                  objparlist.Add(objc);
              }
          }
          return objparlist;
      }

private void populate_bal(System.Data.IDataReader dr, vote objc)
      {
          objc.id = dr.GetInt32(0);
          objc.candidateName = dr.GetString (1);
          objc.candidateSurname = dr.GetString(2);
          objc.candidatePic = (Byte[])dr.GetValue(3);
          objc.standingyear = dr.GetString(4);
      }
Posted
Updated 2-Sep-11 1:49am
v5
Comments
RaviRanjanKr 2-Sep-11 16:06pm    
hey! its little bit confusing for me. whats vote parameter in populate_bal. please give more information.

1 solution

Hi,

Could you take a review on populate_bal(), cause you are calling this in a loop and pass the entire dataReader parama every time!
 
Share this answer
 
v2

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