473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Master/Detail Databinding issue

Dear group,

I have an invoice entry form, which is a simple Master fields / Detail grid.
The main summary information of the invoice are stored in one table in a
dataset, which is bound using a BindingSource (InvoiceBindingSource). The
line details of each item in the invoice is held in a child table which is
bound to another bindingsource (InvoiceRowsBindingSource).

I took the basic design from an MSDN article, and all works well. However...

When I come to save the record
(taInvoiceRows.update(Dataset.InvoiceRowsTable)), sometimes I get a message
similar to: "You cannot save this table, because a row is required in
Invoice [the master table].

I know the problem is most likely related to the way I'm saving:

Save subroutine:

' Save master binding source (invoice)
InvoiceBindingSource.EndEdit()
' Save detail binding source (invoice rows)
InvoiceInvoiceRowsBindingSource.EndEdit()

' Call tableadapter update for master table
bInvoiceSaved = _taInvoice.Update(DsInvoice1.Invoice)

' Call tableadapter update for row table *******OCCASIONAL RANDOM CRASH
HERE***********
bInvoiceRowSaved = _taInvoiceRow.Update(DsInvoice1.InvoiceRows)
I also call .EndEdit for the master bindingsource whenever any of the master
fields lose focus. I also call .EndEdit for the detail bindingsource
whenever any row of the grid loses focus.

My first question is:

1) How should I handle this error? (row not present in the master table when
updating the child table)
2) What's the correct way to do this? (save a Master/Detail form?)

The error is apparantly random, I don't yet have steps to reproduce it
accurately every time. Other than this, the form works fine. Both the master
and detail grid have other lookup comboboxes representing other fields, all
working ok. The dataset was created in the DataSet Designer, and the
database is a Microsoft Access MDB (so I'm using Jet for connectivity).

I'm stuck, but can't find any guidance on the "right way" to do a
Master/Detail form. I'm obviously not doing the right things, in the right
events. Please help!

Many thanks,

May 6 '07 #1
0 1692

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

Similar topics

2
by: ruca | last post by:
Hi, I have a master and a detail datagrid. I put detail grid showing insise of a column of master grid. The problem is that it's not what I really want. What I really want would be that the...
0
by: A.C van Bers | last post by:
Hi All, I'm having a problem doing master-detail in ASP.Net with the automatic databinding on GridView components.. What I would like to achieve is something like this (simplified) Students...
0
by: stefanjohansson_2005 | last post by:
I can databind to a relation in WindowsForms for example: I have a typed DataSet with an "Orders" table and a "Order Details" table. They have a relation called "OrderRelation". I have a...
7
by: erniej | last post by:
as per instructions in the walkthrough, I have managed to create a master/detail relationship between two datagrids. However I have a requirement to apply this to three datagrids and the third...
0
by: Sam | last post by:
Folks, Attached I am sending 2 URL's from MSFT ASP.net Quick Start Tutorial Web Site. 1) Run it URL: http://www.asp.net/QuickStart/aspnet/samples/data/GridViewMasterDetailsInsertPage_vb.aspx 2)...
1
by: Sam | last post by:
Attached I am sending 2 URL's from MSFT ASP.net Quick Start Tutorial Web Site. 1) Run it URL: http://www.asp.net/QuickStart/aspnet/samples/data/GridViewMasterDetai... 2) View Source URL:...
0
by: Sam | last post by:
Sorry to post the same post multiple times but the URL Addresses were not Correct in Earlier Posts. Here are the correct URL's: 1) Run It URL is here: ...
1
by: Alan Samet | last post by:
I know what's causing this, but how do I work around it? ********************** file: test.master: ********************** <%@ Master %> <script runat=server> void Page_Load(object sender,...
2
by: John | last post by:
Hi I am trying to create a master/detail form. I have my master and details tables dragged onto the dataset. I have also dragged the fields from master table on the form which has created the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.