Solved

database update frm datagrid

Posted on 2003-11-07
5
221 Views
Last Modified: 2010-04-16
hello all

 following is my sample code
 
OleDbConnection conn = new OleDbConnection ("Provider= Microsoft.Jet.OlEDB.4.0;
Data Source = c:\\book.mdb;");

OleDbCommand  command = new OleDbCommand ("SELECT * FROM addressbook",conn);

OleDbDataAdapter adapter = new OleDbDataAdapter(command);

DataSet ds = new DataSet();

adapter.fill(ds,"addressbook");

dgrid.SetDataBinding ( dset, “addressbook” );


now its displaying the entire table (addressbook ) my datagrid (dgrid)

if i want to update the tablenow -  how to do ?

pls help
0
Comment
Question by:karthikeya
5 Comments
 
LVL 4

Accepted Solution

by:
Tonylmiller earned 50 total points
ID: 9702401
One easy way is just to edit the data in the data grid, either through code or let the user do it.  The dataset will be updated automatically and you can pass it back to the database to update the table.

Good luck!

Tony
0
 
LVL 20

Assisted Solution

by:TheAvenger
TheAvenger earned 50 total points
ID: 9708110
You should call adapter.Update (ds, "addressbook");

Note that there is a small problem with the DataGrid and you may have to call dgrid.EndEdit() before you update the table, otherwise some changes will be lost.
0
 
LVL 1

Expert Comment

by:Jazzle
ID: 10585939
did you ever sort this?
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

816 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

8 Experts available now in Live!

Get 1:1 Help Now