I already have the basic or syntactic structure that should make my loop work, but for some reason I get this error:
Error 20 The foreach statement can not work on variables of type 'System.Data.DataTable' because 'System.Data.DataTable' does not contains no public definition for 'GetEnumerator' C: \ Users \ NQ054 \ Desktop \ SGSIA \ App_Code \ Configuration \ Empresa.cs 141 8 C: ... \ SGSIA \
The syntax of my foreach is the following
foreach (DataRow datos in plantas)
{
crearHTML(datos.ToString);
}
The creation of my table is as follows:
storedProcedure sp = new storedProcedure("DBSGSIAConnectionString");
DataTable plantas;
plantas = new DataTable();
string planta;
string query = "select * from v_DatosEmpresa;";
plantas = sp.getValues(query);
planta= Convert.ToString(plantas);