Solved

database update frm datagrid

Posted on 2003-11-07
5
235 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
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.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

691 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