问题描述
- 新手求指教 Winform Entity Framework 我在每个窗体里这么写合适吗?
-
和MVC的写法一样namespace TestWinForm.ViewForms.ViewAll
{
public partial class ViewPlansForm : Form
{
TestEntities db = new TestEntities();public ViewPlansForm() { InitializeComponent(); } private void barEditItem1_EditValueChanged(object sender, EventArgs e) { DateTime dateTime = Convert.ToDateTime(this.barEditItem1.EditValue); var planModels = from m in db.Plans where m.StartTime == dateTime select m; var PlanList = planModels.ToList(); this.gridControl1.DataSource = PlanList; } }
}
时间: 2024-11-27 16:56:05