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. C#
  4. DataGrid & DataRelation

DataGrid & DataRelation

Scheduled Pinned Locked Moved C#
question
1 Posts 1 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.
  • R Offline
    R Offline
    RoyRose78
    wrote on last edited by
    #1

    Hey all, I have DataRelation object between 2 tables & 2 DataGrids. for some reasons, I delete the relation, activate an operation on the tables & then create the relation back. here is some code: //before the operation starts: Ds.Relations.Clear(); Ds.Tables["Cust2"].Constraints.Clear(); //after the operation DataColumn dc1 = Ds.Tables["Cust1"].Columns["Id"]; DataColumn dc2 = Ds.Tables["Cust2"].Columns["Id"]; DataRelation Dr = New DataRelation("cust1to2", dc1, dc2); Ds.Relations.Add(Dr); everything is ok until now. but when I tried to connect the tables to the datagrids: DtGrd1.SetDataBinding(Ds, "Cust1"); DtGrd2.SetDataBinding(Ds, "Cust1.cust1to2"); I get the exception: "Cannot have a relationship between tables in different DataSets" does anyone know what is going on?? thanks RoyRose

    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