How can I easily view the contents of a datatable or dataview in the immediate window

后端 未结 8 1584
情书的邮戳
情书的邮戳 2020-12-04 13:02

Sometimes I will be at a breakpoint in my code and I want to view the contents of a DataTable variable (or a DataTable in a DataSet).

8条回答
  •  被撕碎了的回忆
    2020-12-04 13:38

    The Visual Studio debugger comes with four standard visualizers. These are the text, HTML, and XML visualizers, all of which work on string objects, and the dataset visualizer, which works for DataSet, DataView, and DataTable objects.

    To use it, break into your code, mouse over your DataSet, expand the quick watch, view the Tables, expand that, then view Table[0] (for example). You will see something like {Table1} in the quick watch, but notice that there is also a magnifying glass icon. Click on that icon and your DataTable will open up in a grid view.

提交回复
热议问题