public Model.User_and_time time1() { DataTable time = SQLDBhelper.ExecuteDataTable(string.Format("select * from time")); Model.User_and_time model = new Model.User_and_time(); model.d1 = Convert.ToDateTime(time.Rows[0]["time1"].ToString()); model.d2 = Convert.ToDateTime(time.Rows[0]["time2"].ToString()); model.d3 = Convert.ToDateTime(time.Rows[0]["time3"].ToString()); model.d4 = Convert.ToDateTime(time.Rows[0]["time4"].ToString()); return(model); }
private void time_Load(object sender, EventArgs e) { this.dateTimePicker1.CustomFormat = "yyyy-MM-dd HH:mm:ss"; this.dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.dateTimePicker2.CustomFormat = "yyyy-MM-dd HH:mm:ss"; this.dateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.dateTimePicker3.CustomFormat = "yyyy-MM-dd HH:mm:ss"; this.dateTimePicker3.Format = System.Windows.Forms.DateTimePickerFormat.Custom; this.dateTimePicker4.CustomFormat = "yyyy-MM-dd HH:mm:ss"; this.dateTimePicker4.Format = System.Windows.Forms.DateTimePickerFormat.Custom; Model.User_and_time model = bll.time1(); dateTimePicker1.Value = model.d1; dateTimePicker2.Value = model.d2; dateTimePicker3.Value = model.d3; dateTimePicker4.Value = model.d4; }