Programatically remove DataTable from DataSet

I created a DataTable programatically in my DataSet and now I want to remove this DataTable from the DataSet in a similar way. How to do this?
LVL 8
rpkhareAsked:
Who is Participating?
 
kerwinsiyConnect With a Mentor Commented:


 
            DataSet ds = new DataSet();
//add datatable on dataset
            ds.Tables.Add();
// cast datatable as dt
            DataTable dt = ds.Tables[0];
// remove dt on dataset
            ds.Tables.Remove(dt);

Open in new window

0
 
BinuthConnect With a Mentor Commented:
ds.Tables.RemoveAt(0)
ds.Tables.Remove(<tablle object>)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.