简体   繁体   中英

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...

DGV where the appointments will be displayed

Add appointments form which adds the data to the database when submitted

You need to start from MVVM architecture pattern first

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

How to bind WPF DataGrid to ObservableCollection

For SQL learn some basic knowledge

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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