如何在调试时查看DataTable [英] How to view a DataTable while debugging

查看:1033
本文介绍了如何在调试时查看DataTable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用ADO.NET和DataSet和DataTables。我遇到的一个问题是,在尝试调试时,很难判断数据表中的值是什么。

I'm just getting started using ADO.NET and DataSets and DataTables. One problem I'm having is it seems pretty hard to tell what values are in the data table when trying to debug.

什么是最简单的方法什么值已保存在DataTable中?在调试时是否有可能看到Visual Studio中的内容,或者是将数据写入文件的唯一选项?

What are some of the easiest ways of quickly seeing what values have been saved in a DataTable? Is there someway to see the contents in Visual Studio while debugging or is the only option to write the data out to a file?

我创建了一个实用函数将DataTable写入CSV文件。但是生成的CSV文件被截断。大约3行从应该是最后一行,在写出一个System.Guid的中间文件刚刚停止。我无法分辨我的CSV转换方法或DataTable的原始人口是否有问题。

I've created a little utility function that will write a DataTable out to a CSV file. Yet the the resulting CSV file created was cut off. About 3 lines from what should have been the last line in the middle of writing out a System.Guid the file just stops. I can't tell if this is an issue with my CSV conversion method, or the original population of the DataTable.

更新

忘记清除我的流编辑器的最后一部分。

Forget the last part I just forgot to flush my stream writer.

推荐答案

使用断点集,填充DataTable或DataSet后,如果将鼠标悬停在变量上,您可以看到放大镜。如果您单击它,它将打开DataTable Visualizer,您可以阅读有关这里是

With a break point set, after the DataTable or DataSet is populated, you can see a magnifying glass if you hover over the variable. If you click on it, it will bring up the DataTable Visualizer, which you can read about here.

在下面的图片中,dt是我的DataTable变量,断点在下面几行,让我将鼠标悬停在这个值上。使用Visual Studio 2008。

In this image you see below, dt is my DataTable variable and the breakpoint was hit a few lines below allowing me to hover over this value. Using Visual Studio 2008.

alt text http: //i25.tinypic.com/2vvkf0x.png

DataTable Visualizer 图片信用):

DataTable Visualizer (image credit):

这篇关于如何在调试时查看DataTable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆