Solved

VB.Net  Saving Data in Datagridview to Access Database

Posted on 2011-09-22
5
607 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 2

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

776 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