简体   繁体   中英

datagridview displaying data repeatedly

Good day everyone,I am currently making a windows application in c#,I am trying to display my data from my database to the datagridview,my problem is whenever I add a second data to my database using the gui, my datagridview display the existing data that already displayed,I know it is just a small problem but I have not found where the problem is. Thankyou everyone.

You need to reset data grid view data source to nothing. And again assign data source.

datagrid.DataSource = null;
datagrid.DataSource = dataSource;

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