how to retrieve data from sqlserver
how to retrieve data from sqlserver . i store 5000 (its amount) i need to deduct the amount (if i give 5000-2000(textbox i give )3000 remaining should be shown in another textbox in asp.net using c#
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
MuthuMari MPosted Apr 30, 2012, 6:42 AM
use like this
select (no1 - no2) 'subtract' from subtract
or
using self join
select a.Number1,
coalesce(a.Number1-
(select b.Number2 from tablename b ), a.Number1) as diff
from tablename
pls refer this url
http://stackoverflow.com/questions/919136/subtracting-one-row-of-data-from-another-in-sql
you have to modify conditions as per your need.
thanks.
If this post is useful then mark it as "Accepted Answer"
selvi subramanianPosted Apr 30, 2012, 6:28 AM
MuthuMari MPosted Apr 30, 2012, 6:13 AM
use the below code
int a=Convert.ToInt32(Textbox1.Text);
int b=Convert.ToInt32(Textbox2.Text);
int c=a-b;
TextBox3.Text=Convert.ToString(c);
thanks.
If this post is useful then mark it as "Accepted Answer"