Link to home
Create AccountLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

How do I name a DataTable in C#?

I finished a program which creates 6-data tables. So, I need to use C# to assigns the names for each table.


How do I do this?


It's a property in the DataTable object, I have heard.


Thanks

Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

private void GetTableNames(DataSet dataSet)

{

    // Print each table's TableName.

    foreach(DataTable table in dataSet.Tables)

    {

        Console.WriteLine(table.TableName);

    }

}

ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account