Dataset Hell!!!!!!!!

  • Thread starter Thread starter Jeff Brown
  • Start date Start date
J

Jeff Brown

I am in Dataset Hell ... @*(&(&*^*^%%#$@# <--simulated cussing

I have a MDI Program and several child windows.
On one child window a dataset is loaded with trailer_Num & Trailer_ID only

On another the dataset is loaded with trailer_Num, Trailer_Location and
several other fields.

My Datasets have been declared in each child Window, but when i change
windows the correct dataset is not accessible.

Basically ... where do i need to declare my datasets since each Child mdi
doesn't need to acces all fields? Do i declare a Dataset in the Parent MDI
and then access certain fields from it for each Child?or do i generate
several
datasets based on the same table (ie 1 for each Child)?

I want my Vb 6 back , dataset smataset ... geeez!!!!! Someone, Anyone ..
Help .. Boss is gonna kill me.. LOL

Also posted in dotnet.languages.adonet

Thanks, Jeff
 
Jeff Brown said:
I am in Dataset Hell ... @*(&(&*^*^%%#$@# <--simulated cussing

Yeah...we know what that means... =)
I have a MDI Program and several child windows.
On one child window a dataset is loaded with trailer_Num & Trailer_ID only

These are the keys you are using or these are the fields you are accessing?
On another the dataset is loaded with trailer_Num, Trailer_Location and
several other fields.

My Datasets have been declared in each child Window, but when i change
windows the correct dataset is not accessible.

What do you mean "not accessible". Do you declare an instance of the
dataset in every child window? And therefore, when you load the dataset in
the mdi main, you can't get any dataout of the child windows? Am I right?
If so, thats because you have to pass in the dataset from the parent to the
child. By Reference will make the changes global.


Basically ... where do i need to declare my datasets since each Child mdi
doesn't need to acces all fields? Do i declare a Dataset in the Parent MDI
and then access certain fields from it for each Child?or do i generate
several
datasets based on the same table (ie 1 for each Child)?

Don't do that...
I want my Vb 6 back , dataset smataset ... geeez!!!!! Someone, Anyone ..
Help .. Boss is gonna kill me.. LOL

No they aren't... and no you don't... once you understand datasets you will
see how powerful they really are. Most people never took full use of ADO
2.7, or at least understood all the features. So what "looks" like new
features in ADO.NET are not really that new. Just easier to understand why.
Also posted in dotnet.languages.adonet

Good... Good...
 
I think you are kinda right maybe if i tell you the situation a little more
clearly.
My main form is an MDI, from the menu i can load my other forms. One for
trucks & one for trailers.
The truck form had several fields bound to a "truck" table, one of these is
an "assigned trailer" field.
On the truck form i have a combobox to select the trailer number assigned
On the Trailer form is just trailer specifics, length width, tag etc etc etc

When i change the program so that the dsTrailers1 dataset on the truck form
contains only the Trail_Num & Trail_Id for combobox displaymember & value
member, i get an from the trailer form error about cannot bind to Trail_VIN
blah blah. I am just trying to populate a combobox from a dataset on a
different form and insert its value into the dataset i am bound to... i
think!!!!

Here is how i have been doing this:
for each form i drag a oledbDataadapter and configure "only" the data i need
and then generate a dataset. so when i generate a dataset named dstrailers
for the trailer form i can see it in the solution explorer, Ok now i go to
my "truck" form and i drag another dataadapter to the form for trucks and
another for trailers. They are named the same thing as i didn't see a need
to have several datasets with the same data with different names. All i am
really trying to do is set the combo boxes on one for to a dataset that is
not on that form, if i could do that withoutadding another dataset i would
not have a problem. But when i look at the combobox datasource it seems i
can only get it from something on the form containing the combobox. I know
there is a simple solution or i am just clicking where i should be clacking
or maybe i am just not getting the idea here. I do know that the dataset is
a "disconnected" copy of the data it represents and only connects to update
and snych with the OLEDB. I have several books here and have searched the
net to no avail, i can find nothing involving using multiple forms and
different columns from the same datasets.

I apologize for not being able to "ask my question" in a simple manner.
 
Hey Jeff,

Alrighty then... here we go...

First of all, never say "I clicked when I should have clacked."

Second, here are a few issues with what your doing. I understand why your
doing them, they just aren't necessarily the "best" way to go about them. I
think a great deal of the trouble stems from your understanding of ADOX.
And there is nothing wrong with that, so don't take it the wrong way.

So we ask, "What is a dataset"

A dataset can contain both data (yeah...) and a schema. Now coming from ADO
2.7 most of us were not real familiar or comfortable with schemas (I wasn't,
just wrote a select statement and off I went.. F**K ADODC.) Soooooo...
Unless you have something constrained (which you can turn on and off with
Enforce constraints) there is no reason to have multiple datasets for the
same stuff... especially if its basic table lookups (when you start getting
into really big joins, and still want to use datasets you can do that, but
otherwise don't worry.)

So. that whole disconnected database is correct, because you can set up
relationships/constraints/keys etc within a dataset. But understand you can
perform everything you want in a dataset, that you would do in a database
itself. I find this particularly useful on machines with a ton of memory
and implementing web applications.

However, you have to remember that a Dataset is a class as well. thats its.
So it has to be treated like a class. Well, component, but lets not go into
that.

anyways... if you want to use a "Universal Data Set" simple fill the
dataadapters on your loading procedure of your main MDI form, and then set a
property for you to pass in that dataset to your child forms.

Create a dataset reference (of the same type) on your child form. Don't
populate it. You are going to use Merge (I always found taht easiest) to
push the two datasets together. and then on form close pass the changes
(getChanges()) back to the original dataset, update the DB if you want...

You have a lot less code, and a lot less hassle this way... you can do it
individually per form, but don't keep "generating datasets" that just gets
really ugly and confusing later.

Hope this explains a little.. or a lot...

=)
CJ
 
yes that helped extremely
still a couple of questions
"anyways... if you want to use a "Universal Data Set" simple fill the
dataadapters on your loading procedure of your main MDI form, and then set a
property for you to pass in that dataset to your child forms."

pass a dataset to a child as in How?
Create a dataset reference (of the same type) on your child form. Don't
populate it. You are going to use Merge (I always found taht easiest) to
push the two datasets together. and then on form close pass the changes
(getChanges()) back to the original dataset, update the DB if you want
as in :
MDI Parent:
dsTrailers as data set ' actually not declared in code but placed on form

child:
'Create a second DataTable identical to the one on parent form in the childs
form load.
Dim t2 As DataTable
t2 = form1.dsTrailers.equipTrailers.clone()
'and merge changes back to original ds when needed?
dsTrailers.Merge(t2)
form1.dstrailers.equiptrailers.getchanges()

I think i am a little clearer, thanks so much , i have been looking
everywhere but it is hard to find topics relating to this without pulling up
a bunch of unrelated.

Thanks Again CJ

Jeff Brown
 
Back
Top