![](/img/trans.png)
[英]Set function ignoring if statement - should be returning 0 if input is less than or equal to 0
[英]Less than or Equal Date should not allow to enter
使用C#和Mysql
当我在文本框中获得输入日期时,它应该与表中的日期进行比较,如果相等,则将引发错误消息,它应该只允许大于日期的日期
例如
Table1
ID Date
001 2010-08-05
002 2010-08-02
....
When i enter the date in the textbox like - 2010-08-04, it should compare with Date in the table1, if it is equal or less than max(date) from table1 then it should throw a error message, otherwise it should allow to insert a date.
是mysql&c#的新手,如何在c#和Mysql中做到这一点。
需要一些代码帮助。
我将首先运行查询并获取最前端应用程序的最大日期...然后根据该应用程序是Web应用程序还是Windows应用程序,我将在Compare Validator(ASP.NET)或Textbox_Validating事件中使用此值来比较值...
如果您不熟悉如何使用Compare Validator或Validating事件,请告诉我,我可以在此处发布一些链接。
如果您想将此限制放在表本身中,则可能需要使用约束/触发器...我不太了解MySql在这里对您的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.