[RESOLVED] Creating relationships between tables in Visual Studios-VBForums
Results 1 to 6 of 6

Thread: [RESOLVED] Creating relationships between tables in Visual Studios

  1. #1

    Thread Starter
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    12,698

    Resolved [RESOLVED] Creating relationships between tables in Visual Studios

    Hi,
    I am currently creating my own portfolio website after a long time of putting it aside. I am using one of my old website from school as a template! Which, has everything I need except when it comes to reconnecting the table relationships after re-design the table in Visual Studio 2010 I have tried both selecting the primary key in the first table and dragging it to the target field in the target table and also the target to the primary key but the relationship between the tables isn't drawn.

    How do I drawn the relationships between tables in VS 2010?

    Thanks,


    Nightwalker
    Last edited by Nightwalker83; Dec 31st, 2012 at 07:29 AM. Reason: Fixed spelling!
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,090

    Re: Creating relationships between tables in Visual Studios

    Thread moved to the 'Database Development' forum

  3. #3
    Hyperactive Member jasonwucinski's Avatar
    Join Date
    Mar 2010
    Location
    Pittsburgh
    Posts
    448

    Re: Creating relationships between tables in Visual Studios

    I've never done this in Visual Studio before. What RDBMS are you using? Oracle, MySQL, and MS SQL (as well as Access) all allow you to create diagrams of your tables. In Visual Studio 2005, you can create these diagrams by opening the project and make sure the Server Explorer is open as well. Assuming the database is attached to the project (if it's not, you can create these diagrams in whatever RDBMS you're using), expand the database node. You will see several folders (Tables, Views, etc). Expand the "Database Diagram" node. If you haven't created a diagram yet, you will be prompted to do so. From there you should be able to add your FK and other relationships. An remember, even if you can visually draw the lines between tables, they are really just visual representations of your relationships and can be created in the table DDL sql.

    Let me know if this helps or if you need more assistance.

    jason
    if i was able to help, rate my post!

  4. #4

    Thread Starter
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    12,698

    Re: Creating relationships between tables in Visual Studios

    Hi Jason,

    In this case I'm using SQL Server Database "*.mdb". I have did this years ago but I have forgotten what I did. Thanks, I will see if the above solution helps me in connecting the tables, of which, I only have two at the moment.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  5. #5
    Frenzied Member
    Join Date
    Jan 2006
    Posts
    1,863

    Re: Creating relationships between tables in Visual Studios

    Open dataset in VS designer-->Right click on the DataTable and select option "Add Relation"
    __________________
    Rate the posts that helped you

  6. #6

    Thread Starter
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    12,698

    Re: Creating relationships between tables in Visual Studios

    Silly me! All I had to do was draw the tables in the "Database Diagram" (making sure the Foreign/Primary Keys were both of the same type) then click the appropriate field in one table and drag it to the matching field in the other table.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    Please consider giving me some rep points if I help you a lot.
    Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.