473,508 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question on DataSource Updates

I have a question. When using a DataGrid, I want to make sure the
datasource gets updated every time the user makes changes and navigated
to a new row.

The way I am doing it now, is I have a PositionChanged event on the
BindingContext. When it changes I call a save routine. The save routine
checks to see if the first column in the datagrid is empty (primary key)
and if it is, cancels the current edit and saves a variable to notify
the save routine to start a new edit when done. It then updates the
datasource and before it finishes checks that variable to see if a new
edit needs to be started for the new row and then initiates a AddNew...
This seems like a bandaid rather than a proper way of doing it.. At
least to me right now.. Is this the proper way or is there a better way
to handle this? I was going to try to use the rowchanged event, but I
couldn't call the save routine in my form...

Thanks,
Aaron
--
---
Aaron Smith
Remove -1- to E-Mail me. Spam Sucks.
Nov 21 '05 #1
1 958
Hi Aaron
From what source do you fill this grid ?
if a data grid is bound to a datatable, then when u make changes, the
datatable is changed too....after that, u can update the datasource using
that datatable ( passing the dataset that include that table to the update
method if the related dataadaptor.) . but if you want these changes to be
reflected on your database . do that before you apply the accept changes
method on your datatable foe when you do that the datatable erase the
old values and keep only the new ones and this way the update command of
the adaptor can't be constructed properly . if you want to ignore this
changes however , just apply the reject changes method on the datatable
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6672
by: Matthew Woods | last post by:
bool A = Is this the right place to ask this question? if (A) { Where can i find a good example of an ArrayList bound to a datagrid that automatically updates the grid when the public data...
5
1728
by: Darrel | last post by:
I thought this warranted a new thread. Yesterday I asked about access relatively static content...is it better to read from the DB, or just grab a text file. It was suggested that I use the DB...
7
34751
by: TJoker .NET | last post by:
I'm developing an VB.NET Windows Forms application that uses CR for VS.NET (original version shipped with VS.NET 2002 - my VS.NET has the latest SP installed, no SPs for CR). My reports get their...
13
1262
by: Lars Netzel | last post by:
I'm trying to copy data from two tables in a Source db into two Tables in a Destination db and the Tables designa are the same. I created 4 adapters... 2 for the two tables in the source db...
1
9169
by: j.zascinski | last post by:
Hi, i have a "simple" problem with gridview, please help me :) i want to have gridview which is binded to a datatable (or a dataset). i can show the data from the dataset in the gridview and i can...
4
13475
by: Jim Katz | last post by:
I have an application that updates a strongly typed data set at run time. I'd like to dynamically create a table that connects to a run time data table. For displaying the data, this works well. ...
0
993
by: Phuff | last post by:
I'm trying to do something and its proving tricky. When someone clicks the edit button I don't want to use the standard textbox, so I create a templated column. I need 2 dropdowns and a textbox. ...
1
3693
by: hal9000cr | last post by:
We are running into some problems with the execution of DB2 stored procedures when their isolation level is set to: set transaction isolation level READ UNCOMMITTED, READ WRITE; This is a web...
0
2186
by: morathm | last post by:
I have a windows client database management application written in C# that connects to remote web services to do all the heavy work. The thin-client app uses strong typed datasets, all maintained at...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.