Solved

VB.Net  Saving Data in Datagridview to Access Database

Posted on 2011-09-22
5
603 Views
Last Modified: 2012-05-12
Hi Experts.  I Have a DGV, a navigator and a bindingsource to an Access database.  The data shows correctly in the DGV and the navigator handles everything in the DGV correctly, such as adding and deleting rows, etc but I see no way of saving the edited DGV back to the Access databse.  Please can someone advise how this is done.  MAny Thanks in advance.
0
Comment
Question by:PNRT
5 Comments
 
LVL 17

Expert Comment

by:nepaluz
ID: 36581164
show some code on how you are loading the data into your DataGridView. Also, have you a preference on how to save it back to Access? (e.g sql, LINQ etc ..)
0
 
LVL 15

Expert Comment

by:David L. Hansen
ID: 36581296
It should automatically.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36582126
What are you feeding into the bindingsource? DataTable? Are you using a TableAdapter? You need to call the Update method on it.
0
 
LVL 1

Author Comment

by:PNRT
ID: 36583123
Hi, Im not using any code at all.    I created a dataset connected to an Access database.   I chose that dataset in the properties of the Datagridview and the bindingsource and the table adapter were created automatically.  I then connected the bindingnavigator to the binding source.   It all works correctly.  The data in the database appears in the datagridview and the navigator navigates the datagridview.   But new  entries in the datagridview are not being saved back to the database.  I thought sl8rz had it right that there would be an option for it to save back automatically?
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 36593822
There isn't. You need to call the Update method on the TableAdapter.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now