有关sql server和c#的简单问题 [英] simple question about sql server and c#

查看:80
本文介绍了有关sql server和c#的简单问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.
我不知道该怎么做.我们有使用我们的运输服务的客户.我构造了名称为Debt的sql server表,该表与传输ID和客户端ID相关联.客户总是在月底付款.我该如何使用c#或sql server对从月初到月末的所有条目进行计数?
对不起,我的英语不好.
我希望我的问题是可以理解的.
请给我一些建议...

Hi everybody.
I cant ponder how to do that. We have clients who use our transportation service. I constructed sql server table with name Debt its relationed with transportation ID and client ID. Clients always pay money at end of month. How can i do with c# or sql server that count all entries from month begining to end of month ?
Sorry for my bad English.
I hope that my question is understandable.
Please Advice me something...

推荐答案

据我所知,
As i understand ur question,
Select count(*) from tablename where paidDate >= ''01/11/2010'' and paidDate <= ''30/11/2010''


首先,设计数据花瓶表,以便可以捕获所有数据.

现在,假设transporationID与ClientID相关,则使用整个月.它会给出类似该transportID * 30天的运输费用!

因此,一般来说,您需要用成本捕获所有使用的天数,然后最后为该客户编写查询并获取所有数据.
Well, first of all design the datavase tables such that you can capture all data.

For now, assuming once a transporationID is related to a ClientID, whole month is used. It would give something like, transportation cost of that transportationID * 30 days!

Thus, to be generic, you need to capture all the used days with cost and then at the end write a query for that client and get all data.


首先,您获得上个月的金额并将其保留在一个变量中,
First u get the last month amount and keep it in one variable,
Select Sum(amount) from tablename where paidDate >= ''01/11/2010'' and paidDate <= ''30/11/2010''


然后,


then,

insert into tablename(remain_amount) values(last_amount - 1000) 


1000是当前输入的金额.


1000 is the currenty entered amount.


这篇关于有关sql server和c#的简单问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆