View the contents of a dataset without using a dataset visualizer

When writing some tests for the project I'm working on, I found that the best way for me to get the data back that I need about whether the project was correct is to put the results in an ADO.NET DataTable. I was tired of setting breakpoints and expected them to hit so I could use the DataSet sample document to find out what my results were and I wanted to see the results after the test was completed, so I decided to find a quick and dirty way to write the DataTable to a file .

After you looked into Intellisense to try to find a good way to get my DataTable into a file, I searched googled a bit and found someone who wrote code to write a DataTable to a table in an html file. I spent a few minutes and realized my own version of this and went with my own fun. I like the html solution because it was very easy to implement, it is fully portable, and it’s easy to refresh the page and see the latest test results after making changes to my code.

At this point, I wonder, however, did I miss the easier / better way to do this? Keep in mind that the requirements should be able to render the table in real tabular form, and not be serialized as XML or any other less readable format, and it should be in a file on the hard drive so I can get back to it. Any ideas?

+3
source share
1 answer

I somehow wrote a number of methods for expanding a DataTable dump in CSV quickly ... the version is only half here, but this will allow you to do one sleeve reset in CSV. The other half of the solution is just a gold plating, allowing you to select specific columns and format text. If you are interested, I can also get this portion.

I don’t know that it provides better visualization than HTML, but the presence in Excel certainly makes a good way to sift and sort the data.

+3
source

Source: https://habr.com/ru/post/1723836/


All Articles