在C#中达到截止日期时关闭项目 [英] Close a Project when a deadline is reached in C#
本文介绍了在C#中达到截止日期时关闭项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试制作一个捐赠计划,当它到达截止日期时我不知道如何关闭捐赠项目。
我希望程序能够在达到截止日期时自动关闭项目。例如,如果项目的截止日期是1月1日,那么项目的状态将自动关闭。
我有一个datagridview,我希望列状态自动从活动更改为关闭。
i有关于如何操作的想法,但我真的不知道如何应用它
I am trying to make a donation program and i do not know how to close a donation project when a it reaches a deadline.
I want the program to automatically close a project when a deadline is reached. for example if the deadline of a project is january 1 then the status of the project would automatically be closed.
I have a datagridview and I want the column "status" to automatically change from "active" to "closed".
i have an idea on how to do it but i dont really know how to apply it
SELECT * from table WHERE deadline > datenow
INSERT INTO table (status) VALUES ('closed') WHERE deadline > datenow
推荐答案
为了实现上述行为,有以下几种方法:
1-创建一个启动批处理程序的Windows服务,以更新db中的状态列。
创建C#服务步骤 - 分步:第一课 [ ^ ]
2-创建SQL作业并将其设置为每天运行,它会在截止日期之前更新数据。
http://msdn.microsoft.com/en-us/library /ms181153(v=sql.105).aspx [ ^ ]
希望有帮助......
In order to achieve the above behavior there are several ways:
1- Create a windows service that kicks a batch program to update the status column in db.
Creating a C# Service Step-by-Step: Lesson I[^]
2- Create SQL Job and set it running every day and it would update the data by end of deadline.
http://msdn.microsoft.com/en-us/library/ms181153(v=sql.105).aspx[^]
Hope it helps...
你好
这里有几种方式:
1-创建SQL作业并在每次需要时执行此操作。你必须在你的jon中使用T-SQL,例如:
更新[ServerName]。[SchemaName]。[YourTableName]
设置状态=''''无效''''
其中Status =''''有效''''和
日期> GETDATE()
2-创建数据字符串并在每次需要时执行上层查询。
3-创建存储过程执行此查询
我希望它能帮助....
如果您需要更多细节,请给我打电话。
Hi
Several ways exists here:
1- Create a SQL Job and execute this every time that you need. you must use T-SQL in your jon for example:
Update [ServerName].[SchemaName].[YourTableName]
Set Status = ''''Deactive''''
Where Status = ''''Active'''' And
Date > GETDATE()
2- Create Data-string and execute upper query every time that you need.
3- Create stored-procedure for execute this query
I hope it hels....
If you need more detail please tel me.
这取决于自动的含义。如果截止日期发生变化,文本会在打开的页面中发生变化吗?我建议获取此数据的proc,根据活动日期返回状态,如果需要,还可以更新此数据。不需要单独的流程,在有人要求提供数据之前,您的数据库是否未更新无关紧要。
It depends what you mean by ''automatic''. should the text change when the deadline changes, in an open page ? I would suggest that the proc that gets this data, returns a status based on the active date, and additionally could update this data if you wanted it to. There''s no need for a separate process, it doesn''t matter if your DB is not updated until someone asks for the data.
这篇关于在C#中达到截止日期时关闭项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文