0

I have a datatable. I need to get and return the schema of the datatable below.

How can I get the schema?

using (var reader = ExcelReaderFactory.CreateReader(stream))
{
    var result = reader.AsDataSet();
    DataTable firstTable = result.Tables[0];
    var schema = ???
}
Filburt
  • 16,951
  • 12
  • 63
  • 111
Terrance Jackson
  • 275
  • 1
  • 8
  • 31
  • What are you calling `schema`? The database structure or the schema name, like "dbo"? – Rubens Farias May 20 '19 at 20:41
  • If you mean the structure, data types, etc., [check this](https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqldatareader.getschematable?redirectedfrom=MSDN&view=netframework-4.8#System_Data_SqlClient_SqlDataReader_GetSchemaTable) – Crowcoder May 20 '19 at 20:45
  • the structure of the table – Terrance Jackson May 20 '19 at 20:45
  • Possible duplicate of [How can I show the table structure in SQL Server query?](https://stackoverflow.com/questions/18298433/how-can-i-show-the-table-structure-in-sql-server-query) – Edney Holder May 20 '19 at 21:11

0 Answers0