473,395 Members | 1,466 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,395 software developers and data experts.

Passing datasources between forms and saving

I am developing an application for pocketpc and this involvs a but of
juggling with different forms.

I have an "order entry" type of application. On the main form I have a
grid which displays Order headers. Let call this form "OrderList"

From this view I edit/enter new orders by opening a new form for
entering data. This is done using (more or less) the designer generated
forms, so I have a "Order edit view dialog. I pass the binding source to
the child form (in constructor). When returning to main form
"OrderList" I update the database (from the orderlist view checking if
dialoresult is ok or cancel). Works fine.

When entering order details I have a form which works much like the
orderList form (let call this OrderDetailList). I have a grid with order
details row. I open the order detail form from "OrderList" passing the
Orderheader binding source to the Order detail form. I enter/edit order
detail rows the same way I do with the order header, ie opening a child
form passing the order detail bindingsource to the edit dialog form.

Note: the Designer has added dataset object (and tableadapters) to the
order detail list.

Now this works fine except for when I try to update the database. I
first had something like this in the OrderDetail form:

OrderDetailTableAdaper.Update(me.OrderDataSet)

which didn't work. I come to the conclusion that it doesn't work because
the DataSet objetc I have in the OrderDetailList is never filled with
data since I have passed the bindingsource from the OrderList form.

Am I correct about this?

Anyway, my next try was to simply using the dataset of the OrderList
from in the update:

OrderDetailTableAdaper.Update(OrderList.OrderDataS et)

Which I don't like because it breaks the encapsulation of the form by
referencing another form.

I then got the idea to "why not pass the datasource of the
bindingsource" like this:

OrderDetailTableAdaper.Update(OrderHdrBindingSourc e.datasource)

but that doesn't work, get some error message about latebound overload
resolution not supported.

How can I do this ?

My own solution which is actually better than saving in the orderlist
view is to do the update when I return to OrderList form. Then I have
all the database updates in one location. But I still want to know how I
could do this in the order detail list without having to reference the
calling form.

I guess one method is maybe to get the the modified rows and pass that
to the update method. But still interestign to knwo if I can reference
the datasource objetc id directly in some way.
Apr 13 '07 #1
0 1524

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

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
5
by: cgia | last post by:
I am porting an old client/server application to asp.net. I used to retrieve data into local tables (Paradox table-files on the client's disk) and work on them before saving them back to the...
5
by: Rod | last post by:
I've written 2 ASP.NET applications (I've worked on one with a team and another by myself). In my ASP.NET pages, when saving data to a backend database I've done it by using the click event of a...
2
by: Mani P.S via .NET 247 | last post by:
(Type your message here) Hi I'm new to asp.net and I need some help I have three forms with some textboxes.I want to pass the values of the textboxes of form1 and form2 to the third form For this...
2
by: Helen Trim | last post by:
I have an application with three forms that are msde visible and activated when needed. It uses Word to open documents and one of the forms is opened as the Word document is closed in the...
0
by: Greg | last post by:
Anyone having issues with their object datasources appearing and vanishing from the datasource browser? I create an object for binding as a datasource in my App_Code folder, compile my web...
0
by: Tina | last post by:
I'm reading articles on the new TableAdapters where it says that a key new advantage is that a single TableAdapter, which can have multiple queries, can be used on multiple forms. Now that was in...
9
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
19
by: cpnet | last post by:
I'm using VS2005, C#, ASP.NET 2.0. I'm trying to create a report using SQL Reporting Services (to be used in local mode so I don't have to deal with SQL Server). When I create a new report in my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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,...
0
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,...
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...
0
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
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...

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.