c# - How to Remove Table from Dataset when it has relations? -


i have dataset , having 'n' number of tables .how can delete table dataset if tables have parent , child relationship .

code:

  if (m_dsset.tables[tablename] != null)             {                 (int icount = m_dsset.tables[tablename].childrelations.count - 1; icount >= 0; icount--)                 {                     m_dsset.tables[tablename].childrelations[icount].childtable.constraints.remove(m_dsset.tables[tablename].childrelations[icount].relationname);                     m_dsset.tables[m_slevelname].childrelations.removeat(icount);                 }                 m_dsset.tables[tablename].childrelations.clear();                 m_dsset.tables[tablename].parentrelations.clear();                 m_dsset.tables[tablename].constraints.clear();             } 

i able delete rows ..but stil table left in dataset..

you need call tablecollection.remove

 m_dsset.tables.remove(tablename);  

Comments

Popular posts from this blog

asp.net mvc 3 - Using mvc3, I need to add a username/password to the sql connection string at runtime -

kineticjs - draw multiple lines and delete individual line -

thumbnails - jQuery image rotate on hover -