Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. how to build relation between tables ???

how to build relation between tables ???

Scheduled Pinned Locked Moved Visual Basic
databasexmlhelptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sumit21
    wrote on last edited by
    #1

    i have a database which contain 2 tables "table1" and "table2" i had defined primary and foreign keys i had use adapter adap1 for "table1" and adap2 for "table2" now i had generated a dataset "ds" using adap1 and adap2 adap1.fill(ds) adap2.fill(ds) now i want to have a relation in both tables in wizard , we can do this by going into schema of dataset and creating relation but can it be done through code plz help code will be more useful

    C M 2 Replies Last reply
    0
    • S sumit21

      i have a database which contain 2 tables "table1" and "table2" i had defined primary and foreign keys i had use adapter adap1 for "table1" and adap2 for "table2" now i had generated a dataset "ds" using adap1 and adap2 adap1.fill(ds) adap2.fill(ds) now i want to have a relation in both tables in wizard , we can do this by going into schema of dataset and creating relation but can it be done through code plz help code will be more useful

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      sumit21 wrote: in wizard , we can do this by going into schema of dataset and creating relation but can it be done through code Surely the wizard generates the code for you. It is normally hidden in a region marked something like "Visual Studio Code Generated. Do not edit". So, if you look at that code then you will see how it is done.


      My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

      1 Reply Last reply
      0
      • S sumit21

        i have a database which contain 2 tables "table1" and "table2" i had defined primary and foreign keys i had use adapter adap1 for "table1" and adap2 for "table2" now i had generated a dataset "ds" using adap1 and adap2 adap1.fill(ds) adap2.fill(ds) now i want to have a relation in both tables in wizard , we can do this by going into schema of dataset and creating relation but can it be done through code plz help code will be more useful

        M Offline
        M Offline
        Mohamed Ishak
        wrote on last edited by
        #3

        Yes Sumit you can do that dim dr as DataRelation dr = new DataRelation("myRelation",ParaentCol,ChildCol) DataSet.Relations.Add(dr)But in this case u can do only with that dataSet tables itself means if u have two tables in dataset u can make ralationship with the two tables I hope this helps Ishak

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups