There are several ways to print or display the contents of a DataTable:
foreach (DataRow row in dataTable.Rows)
{
foreach (DataColumn col in dataTable.Columns)
{
Console.Write(row[col] + "\t");
}
Console.WriteLine();
}
WriteXml
method to write the contents to an XML file:dataTable.WriteXml("data.xml");
dataGridView.DataSource = dataTable;
var results = from DataRow row in dataTable.Rows
select row["ColumnName"];
foreach (var row in results)
{
Console.WriteLine(row);
}
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-04-30 00:04:55 +0000
Seen: 10 times
Last updated: Apr 30 '23
What is the name of the file containing the Cypress reporter results?
Is it possible to not get any results when using Strings.Instr or IndexOf to search for a substring?
How can I set values on a Map using more than one parameter from a nativeQuery?
Can a literal search be performed even after applying stemming?