Sie sind auf Seite 1von 1

ALTER FUNCTION [dbo].

[depreciation] (@value float,@years float) RETURNS @table table( Year float, Cost_of_Asset float, Depreciation float, Total_Depreciation float, Residual_Value float ) AS BEGIN declare declare declare declare declare

@rv float @a float @ta float @nv float @i float

set @rv=@value set @a = @value/@years set @i=1 while(@i<=@years) begin set @ta=@a*@i set @nv=@rv -@a*@i set @nv = @rv - @a * @i insert into @table values(@i, @rv, @a, @ta,@nv) set @i=@i+1 end return END SELECT * FROM depreciation(5000000,5)

try { Label5.Text = ""; localhost.Service1 am = new localhost.Service1(); DataSet ds = new DataSet(); ds = am.Depreciation(float.Parse(TextBox1.Text), int.Parse(TextB ox2.Text)); GridView1.DataSource = ds; GridView1.DataBind(); TABLE_HEADER.Text = "DEPRECIATION"; } catch (Exception ex) { Label5.Text = ex.Message.ToString(); }

Das könnte Ihnen auch gefallen