Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Xml needed without reason

Tags:

c#

.net

protected override DataTable internalExecuteTable(string SQL)
{
    DbDataReader reader = ExecuteReader(SQL);
    DataTable dt = new DataTable();
    dt.Load(reader);
    reader.Close();
    return dt;
}

"internalExecuteTable" is underlined and throws an error that "System.Xml" is not referenced and I should add the "System.Xml" reference. But why?

I use the above code to read from an SQLite database (System.Data.SQLite wrapper)

like image 797
teamalpha5441 Avatar asked Dec 26 '22 07:12

teamalpha5441


1 Answers

You are using System.Xml indirectly. The DataTable has dependencies upon classes defined in the System.Xml assembly. If you look at the documentation for the class or if you simply explore it in your IDE, you will note that it includes many methods for reading and writing XML, for example.

By using System.Data.DataTable, you also need to reference System.Xml.

like image 108
Anthony Pegram Avatar answered Dec 29 '22 00:12

Anthony Pegram