List Info

Thread: Create a Joined table from two tables in a Dataset




Create a Joined table from two tables in a Dataset
user name
2006-03-30 12:40:37
i may be getting myself confused with the asp.net grid...its
been a while
since ive used grids....but anyway...

there should be a way to pull a value from a field in a
related table...i
think it comes from specifying the correct binding path to
the
field....maybe when you set which field a column is bound to
you can specify
it like this...
"roottable.relationshipname.othertablefieldname"



-----Original Message-----
From: Discussion of writing applications and components
using Visual Basic
.NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM]On Behalf Of Mauricio
Benavides
Sent: Wednesday, March 29, 2006 6:51 PM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: [VBDOTNET] Create a Joined table from two tables in
a Dataset


Is it possible to create something like a
"TableView" that "Joins" two
tables from a dataset? (I know there is not such a thing as
TableViews, but
it sort of helps me explain since with a Dataview this can
not be achieved).
Something equivalent to using the SQL select statement:



SELECT     Table1.Field1, Table1.IDParent, Table2.IDChild

FROM         Table1 INNER JOIN

                      Table2 ON Table1.IDParent =
Table2.IDChild



I have a dataset with two tables that I want to relate
through a Join
statement and bind the resulting table to a DataGrid so that
I have
information from both tables in each row. I have goggled
this and the
solution is to use a DataAdapter to get the resulting table
from the SQL
Database. I don't want to go that path. The reason is that
I already have
the two tables in the dataset (which I am already using
separately on
separate dataviews and databindings) and if I import them
again, they will
behave as different tables and the changes in one will not
reflect the
changes in the other tables. Additionally, having two times
the same data
will waste memory unnecessarily



If I can join them from the DataSet, put them in a DataView
and bind them to
the datagrid, the changes made (I hope) will be reflected in
each table in
the dataset. Of course, the changes made to each table
through any other
dataview will affect the tables as well.



Any ideas on how I can achieve this using "only"
the tables from the
dataset? I was hopping the DataViewManager would have this
functionality,
but apparently it does not.





Thanks,



Mauricio






===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.3/296 - Release
Date: 3/29/2006

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.3/296 - Release
Date: 3/29/2006

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Create a Joined table from two tables in a Dataset
user name
2006-03-30 17:30:15
Does anybody know how to implement Phil's suggestion? Any
link or example I
can check? I put some thinking on it and try some
approaches, but I couldn't
figure it out.

I am also looking forward to seeing some other approaches to
my problem.

Thanks,

Mauricio

-----Original Message-----
From: Discussion of writing applications and components
using Visual Basic
.NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On Behalf Of Phil
Sayers
Sent: Thursday, March 30, 2006 7:41 AM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Create a Joined table from two
tables in a Dataset

i may be getting myself confused with the asp.net grid...its
been a while
since ive used grids....but anyway...

there should be a way to pull a value from a field in a
related table...i
think it comes from specifying the correct binding path to
the
field....maybe when you set which field a column is bound to
you can specify
it like this...
"roottable.relationshipname.othertablefieldname"



-----Original Message-----
From: Discussion of writing applications and components
using Visual Basic
.NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM]On Behalf Of Mauricio
Benavides
Sent: Wednesday, March 29, 2006 6:51 PM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: [VBDOTNET] Create a Joined table from two tables in
a Dataset


Is it possible to create something like a
"TableView" that "Joins" two
tables from a dataset? (I know there is not such a thing as
TableViews, but
it sort of helps me explain since with a Dataview this can
not be achieved).
Something equivalent to using the SQL select statement:



SELECT     Table1.Field1, Table1.IDParent, Table2.IDChild

FROM         Table1 INNER JOIN

                      Table2 ON Table1.IDParent =
Table2.IDChild



I have a dataset with two tables that I want to relate
through a Join
statement and bind the resulting table to a DataGrid so that
I have
information from both tables in each row. I have goggled
this and the
solution is to use a DataAdapter to get the resulting table
from the SQL
Database. I don't want to go that path. The reason is that
I already have
the two tables in the dataset (which I am already using
separately on
separate dataviews and databindings) and if I import them
again, they will
behave as different tables and the changes in one will not
reflect the
changes in the other tables. Additionally, having two times
the same data
will waste memory unnecessarily



If I can join them from the DataSet, put them in a DataView
and bind them to
the datagrid, the changes made (I hope) will be reflected in
each table in
the dataset. Of course, the changes made to each table
through any other
dataview will affect the tables as well.



Any ideas on how I can achieve this using "only"
the tables from the
dataset? I was hopping the DataViewManager would have this
functionality,
but apparently it does not.





Thanks,



Mauricio






===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.3/296 - Release
Date: 3/29/2006

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.3.3/296 - Release
Date: 3/29/2006

===================================
This list is hosted by DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection
around
http://mail.yahoo.com

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )