简体   繁体   English

将数据插入数据网格视图 c#

[英]Inserting data into Data Grid View c#

I am developing a diary application that allows user to insert appointments into a diary so they can see what others are doing during that week.我正在开发一个日记应用程序,该应用程序允许用户将约会插入日记中,以便他们可以看到其他人在那一周内在做什么。

I've created an add appointments form which submits the appointment into the database successfully.我创建了一个添加约会表单,它成功地将约会提交到数据库中。 But now i want to make these appointments visible in the data grid view under the correct date.但现在我想让这些约会在正确日期下的数据网格视图中可见。 As you can see by the attached photo the current week is along the top, and the users are down the side.正如您在所附照片中看到的那样,当前周在顶部,而用户在侧面。

Any idea how i can make a start on this?知道我该如何开始吗? I'm new to c# and SQL so its quiet a challenge...我是 C# 和 SQL 的新手,所以它是一个安静的挑战......

DGV where the appointments will be displayed将显示约会的 DGV

Add appointments form which adds the data to the database when submitted添加约会表单,在提交时将数据添加到数据库

You need to start from MVVM architecture pattern first你需要先从MVVM架构模式开始

https://www.wintellect.com/model-view-viewmodel-mvvm-explained/ https://www.wintellect.com/model-view-viewmodel-mvvm-explained/

Use observation collection and set data in observation collection and with the help of binding the data will auto-update in data grid view使用观察集合并在观察集合中设置数据,并在绑定的帮助下数据将在数据网格视图中自动更新

Use Binding to update data in the data grid使用 Binding 更新数据网格中的数据

How to bind WPF DataGrid to ObservableCollection 如何将 WPF DataGrid 绑定到 ObservableCollection

For SQL learn some basic knowledge对于SQL学习一些基础知识

https://parallelcodes.com/wpf-mvvm-datagrid-bind-from-sql-database/ https://parallelcodes.com/wpf-mvvm-datagrid-bind-from-sql-database/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM