473,626 Members | 3,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

*Update a parent from the child

1 New Member
I have 2 forms.. a customer form and an addnew customer form. Basicially when you click on the addnew button, the addnew form opens.

In the parent form, I add a new item using the bindingsource.. . and then I am passing that new item as a datarowview to a child form.

In the child form, all of the controls are bound to a bindingsource component based on the customer. In the constructor for the child form, I am changing the bindingsource.d atasource to the datarow that I am passing in. The user makes his edits in the child form, and then when he accepts... the endupdate() method is called on the child's binding source. then in the parent form, I am calling the resetcurrentite m() to pull in the updates that were made in the child.

It seems that the resetcurrentite m, is not functioning as expected, and I don't know why.
Here is a sample of the code.

Parent form on click....
//adding a new item to the datasource in memory and assigning it
//to a new object
datarowview item = (datarowview)th is.customerbind ingsource.addne w();

//opening the child form, and passing it the item
new_cust_Form dlg = new new_cust_Form(i tem);

dlg.ShowDialog( );
//resetting the binding source in order to capture the updates made by the child form
this.customerbi ndingsource.res etcurrentitem() ;


-------------------------------------------------------
//the child form

new_cust_form(d atarowview item)

this.custdetail bindingsource.d atasource = item



// and then when the form closes...

this.custdetail bindingsource.e ndedit()

this.close()


everything works ok, except for the resetcurrentite m() is not showing in the parent form
Oct 26 '06 #1
0 1350

Sign in to post your reply or Sign up for a free account.

Similar topics

0
5898
by: Fraser Hanson | last post by:
Hello, I have a table which has a foreign key relationship with itself. I want and expect my updates to cascade (deletes definitely cascade as expected) but instead I just get error 1217: foriegn key error. I have written example code to use in reproducing the problem: # Create the table
9
12971
by: jaYPee | last post by:
I have search a lot of thread in google newsgroup and read a lot of articles but still i don't know how to update the dataset that has 3 tables. my 3 tables looks like the 3 tables from northwind database that has an employees, orders, and order details. the following are the 3 tables in my sql database students schyrsem
2
2014
by: Richard | last post by:
Hi, I have 1 dataset with 2 tables (Table1 as parent, Table2 as Child), 1 row in both the tables. I am updating it with a transaction. First parent then child. When child update fails, it raise an exception, and rollback the parent update. But it also change the rowstate of the parent row from Added to unchanged When you try to save again parent row never get created in database. So child update will fail again. Please suggest what am I...
3
2404
by: PAUL | last post by:
Hello, I have 2 datasets I am trying to update. The parent table seems to update fine but when I go update the chiled table I get an error message that says I need a related record in the parent table. However I put some code in to display the key field of each parent table record (parent dataset) and the value I am trying to put into the child table is there. ParentTable ChildTable ID------------------------<...
5
3531
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I do the update the changed parentid in the child table fails to change. No error is given its just that the change is not written to the Database. When I step through the records for the child table the one I would expect to be changed has a row...
1
2622
by: James Hallam | last post by:
I have a parent record with a child record. The parent record contains structures and the child records contains visits to those structures. Each table has a field named "Complete", what I want is the structure 'complete' to be changed to true when ANY of the visits have been completed. I have tried to implement SQL to do this, but it gives me the error
1
2767
by: Hexman | last post by:
Hello All, What I'm trying to do is update a child record using a parent-child relation. I want to find out if it is faster than than doing multiple selects. Anyways, I've created a dataset (ds), have 2 datatables (dtRC and dtST). Created the parent-child relationship with multiple columns and added the relation to the dataset. Now what I want is to move through each of the dtRC (parent) records, get all related dtST (child) records...
6
7263
by: | last post by:
Hi, I'm steel trying to read and update my XML file with Visual Basic Express but i am unable to find the right way to read my xml file and update it if neccessary... Here is my problem : evry day, i store the number of children in my classroom in my XML file. For exemple, on monday, my app ask me something like this : msgbox ("Are the 28 children here today ?",vbyesno)
3
2409
by: G .Net | last post by:
Hi Everybody I was wondering if anybody could help me with something that has been bothering me for some time. Basically, it is a problem I encountered some time ago with DataSets. I found a solution (which I will refer to later) but I have a gut feeling that there must be an easier way to do it. In order I can explain the problem, consider the following: Suppose I have a DataSet which has two tables "Customers" and "Orders". I set up...
0
8269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8203
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8711
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8642
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5576
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.