Home Forums Data Warehousing Integration Services Loop or iterate through resultset or recordset by column, using C# only RE: Loop or iterate through resultset or recordset by column, using C# only

  • string columnname = "Name";

    DataTable myTable; -- don't forget to initialize datatable

    foreach(Datarow row in myTable.Rows){

    Console.WriteLine(row[columnname]);

    }

    Haven't tested it, but it shouldn't be far off.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP