开发者

VB.NET - Debugging and DataSets?

Anyway to view the content of a dataset or datatable in debug? 开发者_如何学编程I don't mean looking up a specific element of the dataset but to view the hole thing.


Yes. Just use the DataSet Visualizer. See this MSDN article about how to use DataTips.


When you're in Debug stepping through code, just hover over the DataSet and click on the little magnifying glass that is there to open the visualizer.


I've found the RightHand dataset visualiser particulary useful on many occasions, particulary when debugging constraint errors as it will show you what constraint has been broken and which rows are in error - something the built in visualiser doesn't do as well showing what rows have been added/changed/deleted.


If you have a particularly large and complex dataset where 'hovering' wouldn't be practical, you can also use the command window. To print values from a dataset, you could use something like the following:

? dsMyDataSet.Tables("NameOfTable").Rows(1).Item("NameOfColumn")

...which would return the value of the named column in the second row (0-based) of the named table in the dataset.

or

? dsMyDataSet.Tables(0).Rows(0).Item(0)

...which would return the value of the first column of the first row of the first table in the dataset.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜