本文介绍了我如何...如何更新列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AOA!
我想问一下我正在用C#制作财务系统项目.我想针对实体更新数据库中的余额列,例如
我的数据库中有四列,如下所示:

AOA!
I want to ask that i am making finance sytem project in C#. I want to update my balance column in databse with respect to entities, for example
I have four columns in my database like this:

account_no        acount_desc        debit    credit      balance
101               furniture           56         0         null
102               furniture            0        46         null



我想在借方为56时第一次更新余额列,然后在贷项为46时第二个条目中余额为56,然后余额为(56-46 = 10),但我想在同一帐户desc的所有余额列中使用此值.怎么可能?
实际上,我正在制作试算表报告.在Crystal Report中,我在公式的帮助下显示余额,但如何将余额保存在数据库表列中?
我想保存某些实体(例如家具)在数据库中的总余额吗?



I want to update the balance column first time when debit is 56 then balance will be 56 in second entry when credit is 46 then balance will be (56-46=10) but i want this value in all the balance column of same account desc. How is it possible?
Actually i am making trial balance report. In crystal report i am showing balance with the help of formula but how can i save this balance in database table column?
I want to save the total balance with respect to some entity like furniture in database?

推荐答案

you should maintain two table

One is main acc and another one is debit and credit table like this tables

 Create table Mainacc(AccNo int identity,AccDesc nvarchar(max),balance float)
 Create table accinvoice(accno int,AccDesc nvarchar(max), debit float,credit float)

 Insert into Mainacc values(1,'furniture',100)

First balance is 100
then
you debit 56 from accno 1

that entry insert to accinvoice table

insert into accinvoice values(1,furniture,56,0)

Update acc set balance=balance-56 where accNo=1

 Second credit 46 from accno 1

that next entry insert to accinvoice table

insert into accinvoice values(1,furniture,0,46)
Update acc set balance=balance+46 where accNo=1


这篇关于我如何...如何更新列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 03:39