簡體   English   中英

小於或等於日期不應該輸入

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM