Click here to Skip to main content
15,888,195 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have used datagridview to show the data from my database, now I want to update the datagridview
with the newly inserted data in my database. How can I do that?
Posted
Comments
Prasad_Kulkarni 14-Jun-13 2:00am    
Can you show your code where you bind your grid from database?

By refreshing the page so that the data is reloaded. A datagridview is more than a simple table, instead of messing with it in a manual way, just let it do it's thing and rebuild itself using the updated data.
 
Share this answer
 
You mean Update the gridview in Asp.net or VB.net
 
Share this answer
 
Formally, we need to rebind the DataGridView, if Insert/Update/Delete operation performed on that. In this case, you do need to take updated data from database and bind the DataGridView again.

--Amit
 
Share this answer
 
You can use this line of code:

YourTableAdapter.Update(YourDataSet.YourTable)


Note that when you debug, it grabs a new copy of the original database from the project folder. It will only change the database which is copied to the debug folder. To see if the change was made, debug the program, make the change, close the program, and then navigate to the debug folder. Then run the exe, and your change should be there.

Hopefully this solves your problem!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900