Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / September 2007

Tip: Looking for answers? Try searching our database.

DataSet Usage

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tom Woods - 17 Sep 2007 19:57 GMT
I've been struggling with the best way to use a DataSet, Bindings and
Adapters in the application I'm laying out.  To start, I'm new with
DataSet's and MS SQL.  I'll start by describing what my goals are:

I have a form that will have a list (grid) of items from Orders.  This list
will be docked to the left side of my form.  It will contain all orders of
the day.  I want to allow the user to create/view multiple orders using MDI.
So when they click on an item in the
list/grid, it will update the focused order form.  If they create a new
order, it will create a new Order from (child mdi).  They could even be
viewing multiple orders.

From the standpoint of design.  What is the best way to setup my DataSet?
Should I have multiple - one for the list and one for each order form?  Or,
can just one be used?

The listing of the orders is staight forward, however, how to manage two or
more records being desplayed is a little more confusing.

When it gets to TableAdapters, can you only have one?  I thought about
having the list/grid use one Fill method and the forms use another.  Can
this be done?

I would like the fields on the MDI Child forms to be bound - if possible.

As you can see, I'm a little lost.  Can anyone shed a little light?

TIA,

Tom
Jim Rand - 18 Sep 2007 19:54 GMT
I'd create a separate dataset for each form as well as for the list grid
form.

The list of orders might have a select statement like "SELECT OrderID,
OrderDate, ...<more fields to display> FROM ...

Each child form would have it's own dataset.  The form constructor would
have OrderID passed as a parameter.  In the form load event fill the the
order info dataset using the OrderID as parameter as in SELECT ... FROM
Order ... WHERE OrderID = @OrderID.

In the list grid form, I'd have it raise an event with the OrderID in the
event args.  I'd have the MDI form listen for those events so that the MDI
form can open a child Order form.

After adding a new order, make sure you manually add the row to the grid
list, or, refresh the grid list from the database.

As an aside, I'd first work with the table adapters and related wizards
until I got to the point they destroyed the project.  Then, I'd move back to
the VS 2003 approach using a component containing multiple data adapters.
Finally, I'd chuck the whole data adapter wizard, bite the bullet, and write
my own wizards either in MS Access or .NET to generate data adapter code.

> I've been struggling with the best way to use a DataSet, Bindings and
> Adapters in the application I'm laying out.  To start, I'm new with
[quoted text clipped - 30 lines]
>
> Tom
Tom Woods - 18 Sep 2007 21:19 GMT
Thank you for your feedback!

I actually have created two small projects to determine the best way to
achive my goals.  In one example, I'm using the BindingSource to tie the
list/grid and some actual bound fields on a form.  However, I don't know how
to get the desiner to see the BindingSource from another form when trying to
add additional fields on a new form.

Are you familier with a way to have Form B see Form A's BindingSource?

Thanks,
Tom

> I'd create a separate dataset for each form as well as for the list grid
> form.
[quoted text clipped - 56 lines]
>>
>> Tom
Jim Rand - 19 Sep 2007 12:28 GMT
I've got a shared dataset for lookup tables.  For example, assuming your
orders have order detail rows that reference inventory, the dataset
dsLookupTbls would contain an inventory table.

On the order form, you would drag a dsLookupTbls component onto the form
designer.  Then you would drag a binding  source onto the form designer.
During the form load, you would hot swap the datasource as in

 bsInventory.DataSource = Helpers.LookupTblSingleton.Instance.dsLookupTbls;

Be careful of binding sources.  There is a nasty bug that Microsoft has been
trying to fix for over a  1 1/2 years.  See KB932491.

Jim

> Thank you for your feedback!
>
[quoted text clipped - 8 lines]
> Thanks,
> Tom
Tom Woods - 19 Sep 2007 13:43 GMT
Jim, thanks for the explaination...

I looked up KB932491 and it looks like it has been resolved.  Take a look:
http://support.microsoft.com/kb/932491/en-us

Thanks again,
Tom

> I've got a shared dataset for lookup tables.  For example, assuming your
> orders have order detail rows that reference inventory, the dataset
[quoted text clipped - 24 lines]
>> Thanks,
>> Tom

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.