Solved

database update frm datagrid

Posted on 2003-11-07
5
213 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Iterate a dictionnary to change values 4 53
Two different visual studio versions 3 23
Error when loading the database 16 57
Error in JQuery 5 39
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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, f…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

14 Experts available now in Live!

Get 1:1 Help Now