i got 2 form...
1 form for add, delete, find record in database(access)
2 form show record in database(same database) use datagridview.

but the problem now,
when i delete or add new record in database at form 1.
then i go to 2 form, try to see record show in datagridview. but record not update..

so anyone can help me?
what i need do?

7 Years
Discussion Span
Last Post by sknake

You need to re-run the query to refresh the data from the database so the changes update your gridview. If you're using a DataSet with table adapters you should call .Fill(dataSet) after the second form closes if data entry occured.


As Scott told you, you have to refill the DataSet, but there is another solution also.

in case you are using Dataset, I suggest create the the variable that will hold the DataSet as public in a Modlue

Add a module to your project, in the module declare the variable Dim MyDS as New DataSet, and use this variable in both forms.



Can you upload your project so I can see how you're doing it? There are a lot of ways to go about this and I need to see which way would be best for you


I have no idea man your project is a mess. Your form names are different than the file names so its impossible to find anything. I only speak english so that also makes it difficult. You have the connection string defined three times in your settings. You have ~5 copies of the database in the ZIP and referenced to external locations on your hard drive, and you have the database included in your project folder. It also copies the database when you build the project to include it in your bin\Debug directory.

If this is more than a refresh error you're probably writing to the wrong database. You have these database everywhere!


i know my project bad..
but can u give some sample code for update the datagridview?


Why don't you create a new project with just two screens and a single database to demonstrate the problem, then upload it? I wasn't able to get a clear idea of how you are using the database to best answer your question. I look forward to hearing from you.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.