根据mysql表列日期选择datetimepicker日期(c#)

时间:2013-07-04 02:44:55

标签: c# mysql datetimepicker

我有两个Windows窗体。一个是Insert new member,另一个是Edit member

插入新会员时,我可以选择Membership Date。我希望将选定的Membership Date转换为Edit member表单,其中我有datetimepicker

示例:我创建了一个ID A-15且成员日期为15/05/2013的新成员。当我想编辑此成员时,我会将Membership ID键入Edit member表单并运行该程序。这会将所有详细信息加载到文本框中,将Membership Date加载到datetimepicker

我遇到了datetimepicker的问题。如何从datetimepicker表格中的信息中选择日期并在MySQL中显示日期?

代码:

CREATE TABLE [DBO].[DONORINFO] ( [MEMBERSHIP_NO] [VARCHAR](10) PRIMARY KEY NOT NULL,
[NAME_STATE] [VARCHAR](10) NULL, [FULL_NAME] [VARCHAR](100) NULL, [STREET_NO] [VARCHAR]
(50) NULL, [STREET] [VARCHAR] (50) NULL, [CITY] [VARCHAR] (50) NULL, [TEL] [VARCHAR]
(50) NULL, [EMAIL] [VARCHAR] (50) NULL, [DIOCESE] [VARCHAR] (50) NULL, [CUS_TYPE]
[VARCHAR] (50) NULL, [MEMBERSHIP_DATE] [DATE], );

1 个答案:

答案 0 :(得分:0)

您需要获得会员资格date value from the datatable并将其设置为datetimepicker

的所选日期
DateTime membershipdate = YourDataTable.Row[0].Field<DateTime>("MEMBERSHIP_DATE");
datetimepicker.Value= membershipdate;