Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 30th, 2009, 12:32 PM
Authorized User
 
Join Date: Mar 2009
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default nTier structure and linked table

I've downloaded great example of Imar Spaanjaar.

http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=476

I've a problem with linked record...

I create an entityA with records of tableA of the DB and entityB with records of tableB of the DB...

but if 2 tables are link (INNER JOIN in DB) how can I use the records of table2 when I work with an entity of table1??

tableA entityA = new tableA();
entityA = tableAManager.GetItem(id);

how Can I use the fields of entity of tableB in entityA?

Thanks
  #2 (permalink)  
Old May 1st, 2009, 12:03 AM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

I don't know the syntax offhand but look up ADO.NET relations. Basically the relationships in your DB get lost when you transfer the data into your dataset, and you have to recreate them in code, ie you have to create the same relationship between entityA and entityB that the two database tables have. Once you do that, they're like one big table and you can grab the information easy.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
  #3 (permalink)  
Old May 1st, 2009, 06:39 AM
Authorized User
 
Join Date: Mar 2009
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply!!!

Can you send me an easy example of what I've to do when I've create entities, classDB and classManager ... for manage JOINED fields in my "master entity"

Thanks
  #4 (permalink)  
Old May 3rd, 2009, 06:48 PM
Authorized User
 
Join Date: Mar 2009
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've tried to see the example ... in Contact Person entity I've

/// <summary>
/// Gets or sets a collection of <see cref="Address" /> instances for the contact person.
/// </summary>
public AddressCollection Addresses { get; set; }

/// <summary>
/// Gets or sets a collection of <see cref="PhoneNumber" /> instances for the contact person.
/// </summary>
public PhoneNumberCollection PhoneNumbers { get; set; }

/// <summary>
/// Gets or sets a collection of <see cref="EmailAddress" /> instances for the contact person.
/// </summary>
public EmailAddressCollection EmailAddresses { get; set; }


These are entities linked ... but I would like to know how to read the items of linked entities using something like this

mycontactperson = ConctatManager.Load(ID)...

Thanks
  #5 (permalink)  
Old May 4th, 2009, 04:36 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,960
Thanks: 79
Thanked 1,559 Times in 1,536 Posts
Default

These are just publc properties for to the associated items. Look at the GetItem method of the ContactPersonManager to see how they are filled.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #6 (permalink)  
Old May 4th, 2009, 04:56 AM
Authorized User
 
Join Date: Mar 2009
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply! Now I see

but do you confirm me that with this method Can I get also "linked" (with join) fields ...of other tables?

Thanks
  #7 (permalink)  
Old May 4th, 2009, 05:21 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,960
Thanks: 79
Thanked 1,559 Times in 1,536 Posts
Default

You could certainly do that, as long as the query (direct SQL or a stored procedure) returns data that your object model understands....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #8 (permalink)  
Old May 4th, 2009, 05:36 AM
Authorized User
 
Join Date: Mar 2009
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes... this is my problem!!

I don't know if I've to do

1) create a SP with all JOIN and fill a ContactPerson entity where I've added X new proprieties with X fields (the JOINED fields of other tables/entities) that I want to have in my ContactPerson Entity

2) manage the JOINED fields in each entity


Could you send me a simple example?

I hope that you can help me!

Thanks
  #9 (permalink)  
Old May 4th, 2009, 05:43 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,960
Thanks: 79
Thanked 1,559 Times in 1,536 Posts
Default

I'm not sure I understand the question and your two options. Can you elaborate?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #10 (permalink)  
Old May 4th, 2009, 05:49 AM
Authorized User
 
Join Date: Mar 2009
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm a little confused about this :-(((


could you send me a simple example (not a working example) ... I would like only to know the right solution!!

Thanks for help me!
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy whole structure of table in #temp table maulik77 SQL Server 2000 2 December 21st, 2006 02:42 AM
Copy table structure sagarbhargava SQL Server 2000 3 November 16th, 2006 03:16 AM
Can a Make Table Query produce a Linked table? kronik Access 5 May 16th, 2006 07:17 AM
change table structure Duncan SQL Server 2000 1 March 3rd, 2005 04:10 AM
Printing of Table structure Vanaj SQL Server 2000 4 July 16th, 2004 02:26 AM



All times are GMT -4. The time now is 06:15 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.