Solved

database update frm datagrid

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Async and await with MVC and Web Api 3 29
Pass through dll 2 36
String manipulation 15 49
c# if statement weird reaction 3 29
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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

18 Experts available now in Live!

Get 1:1 Help Now