Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have a gridview in asp.net with backend sql. I need to add the first cell value with the second cell value in the same column and display result in next column.
Eg: sql table:
NO Item TYPE QTY

1 glass Transfer 2
2 glass Invoice -1
3 glass Transfer 4

and I need to display the result as

NO Item TYPE QTY Balance

1 glass Transfer 2 2
2 pen Invoice -1 1
3 glass Transfer 4 5

I need to add the 4th column first cell with 2nd cell and display result in 5th column.
Pls help.
Posted
Updated 4-Jul-15 22:00pm
v2
Comments
What have you tried?
Suvendu Shekhar Giri 5-Jul-15 14:30pm    
What do you mean by Cell and Column ? Looks very confusing. Do you mean "Row" when you are saying "cell"?
barneyman 5-Jul-15 23:25pm    
sounds like you need to add a 'balance' column to the sql query you're populating the gridview with
Member 11357862 6-Jul-15 1:57am    
Yes, I need to add the balance column like I shown in the example table 2
Member 11357862 6-Jul-15 2:57am    
I have tried lag function, but its not working in sqlserver 2008

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