Is There a Better Way to Count the Number of Columns in an Access Database Table?

45 Views Asked by At

I need to count the number of columns in a Table in an Access Database.

The following code does the job, but I wonder if there is a better way using INFORMATION_SCHEMA.COLUMNS ?

CmdStr = $"SELECT TOP 1 * FROM [RoundData]";                                                                              
ReadCmd = new OleDbCommand( CmdStr, ResultsReportingOleDbConnection );
Reader = ReadCmd.ExecuteReader();
int NbrColumns = Reader.FieldCount;
0

There are 0 best solutions below