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

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -