Problem: ambiguous reference between data table (Microsoft.Office.Interop.Excel vs. System.Data)

Problem: ambiguous reference between data table (Microsoft.Office.Interop.<wbr />Excel vs. System.Data)

I have a C# file that has the following in its list of ‘using’ statements:
using System.Data;
using Microsoft.Office.Interop.Excel;

Building it gives me an ambiguous reference to type DataTable.
Leaving off just the System.Data makes DataRow undefined.
Leaving off just the Microsoft.Office.Interop.Excel makes Excel undefined.

How can get out of this “Catch-22”?

Thanks very much,


Solution: ambiguous reference between data table (Microsoft.Office.Interop.<wbr />Excel vs. System.Data)

Just fully qualify the class as you desire:

Instead of using DataTable, use:
System.Data.DataTable
or
Microsoft.Office.Interop.Excel.DataTable

Usually is the first one.