Mohan
Mohan

Reputation: 248

Trying to read values only once among several times

i have retrieve value from database which has 19 repeated columns values and wanted if once value is read then not need to repeat 19 times for same condition and then control should goes to next condition match. Actually i want to print the page as pdf but currently in pdf it is printing 19 times same value .Any idea how to restrict it to one time.

OracleDataReader ReadData = objFetchCmd.ExecuteReader();
 while (ReadData.Read())
  {
   if (p_name == "1snp")
   {  
    lblND_Tr.InnerText = lblND_Tr.InnerText + t_property +"," ;                            
    }
   if (p_name == "1pns")
   {
     lblPD_Tr.InnerText = lblPD_Tr.InnerText + t_property +"," ;                            
    }

Any idea would be appreciated.

Upvotes: 0

Views: 43

Answers (1)

Vinayak Sharma
Vinayak Sharma

Reputation: 11

The problem does not rely in your code just modify your SQL query with Distinct. like select distinct from ; EX: Select distinct * from student;

objFetchCmd.CommandText="select distinct * from student";
OracleDataReader ReadData = objFetchCmd.ExecuteReader();

Upvotes: 1

Related Questions