471,599 Members | 1,390 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Best practice for DataSet/DataTable use w/several forms

Hi,

None of the C#/ADO documentation I was able to read refers what are the best
practices/implementations for this "kind of" problem, I would like to get
help/opinions please, let me explain it:

a) The App have several forms, parent and childs.
b) On the parent Form I have one DataGrid displaying "myDataTable".
c) On child Forms I have to edit just one Row of data from "myDataTable".
d) After the Row edit finish on the child form the DataGrid on parent form
must update.

1) Should we keep "myDataTable" on one static variable on parent Form and
pass it to child forms as parameter to allow that child form to use
"myDataTable" ?

2) Or should we use one independent instance/connection for "myDataTable" in
each new child form we create ?

3) Any other best practice ?

Thanks.
-------------------------
Romao.C#.fun = true;

Nov 17 '05 #1
1 2575
Hi,

Or course you will not find an answer like this in an ADO book, this is more
a design question.

The answer depend of your particular application.

I see two options:

1- You keep the Dataset private to Form1 , when you edit one row you pass
this row to the child form, it does update there and after that all you
would have to do is refresh the parent form. I would go this way if the
application is small or the data being edited is simple, if it does depend
of other tables or you have several tables that are related I would go for
option 2)

2- You create a static class from where you access the dataset, this way
it's available to all the application. You define methods to load/save or
make any other needed manipulation there.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Romao" <Ro***@discussions.microsoft.com> wrote in message
news:3A**********************************@microsof t.com...
Hi,

None of the C#/ADO documentation I was able to read refers what are the
best
practices/implementations for this "kind of" problem, I would like to get
help/opinions please, let me explain it:

a) The App have several forms, parent and childs.
b) On the parent Form I have one DataGrid displaying "myDataTable".
c) On child Forms I have to edit just one Row of data from "myDataTable".
d) After the Row edit finish on the child form the DataGrid on parent form
must update.

1) Should we keep "myDataTable" on one static variable on parent Form and
pass it to child forms as parameter to allow that child form to use
"myDataTable" ?

2) Or should we use one independent instance/connection for "myDataTable"
in
each new child form we create ?

3) Any other best practice ?

Thanks.
-------------------------
Romao.C#.fun = true;

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by D Witherspoon | last post: by
136 posts views Thread by Matt Kruse | last post: by
10 posts views Thread by Rich Wallace | last post: by
reply views Thread by Anonieko Ramos | last post: by
4 posts views Thread by Robert Bravery | last post: by
7 posts views Thread by Steve | last post: by
2 posts views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

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.