Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
EMPNO ENAME SAL SAL*2
1234 JOHN 191.9 383.800
3242 ROSER 191.131 382.262
7788 JAMES 190.291 380.581
7839 CLARK 189.476 378.952
110 MAHESH 188.683 377.366
102 RANI 187.91 375.838






The above date is shown in grid view


OracleConnection cn = new OracleConnection("DataSource=crmtest;UserID=scott;Password=tiger;Unicode=True");
   OracleDataAdapter adp;
   DataSet ds = new DataSet();

   protected void Page_Load(object sender, EventArgs e)
   {
       adp = new OracleDataAdapter("select empno,ename,sal,sal*2 from emp",cn);
       adp.Fill(ds);
       GridView1.DataSource = ds;
       GridView1.DataBind();
   }


i want to see when the column sal*2 value 383.800.when the column value is less then 5 fron 383.800 it will add 1000 automatic in the next row something like this

EMPNO ENAME SAL SAL*2 SHG
1234 JOHN 191.9 383.800
3242 ROSER 191.131 382.262
7788 JAMES 190.291 380.581
7839 CLARK 189.476 378.952 1000
110 MAHESH 188.683 377.366
102 RANI 187.91 375.838
Posted
Updated 21-Mar-12 21:02pm
v2
Comments
sravani.v 22-Mar-12 3:03am    
Added <pre> tags

1 solution

Change your query. Something like
select empno,ename,sal,sal*2, (case when (sal*2) -5 > sal then sal + 1000 else sal) from emp"
 
Share this answer
 
v2
Comments
[no name] 22-Mar-12 3:20am    
Change sal*2 -5 > sal to (sal*2) -5 > sal
Good Solution. Take 5+
Abhinav S 22-Mar-12 4:06am    
Thank you. Yes, the OP can change the condition as required - I just gave him an idea.

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