pghtech
pghtech

Reputation: 3702

How can I see a full view of a datatable?

So I have read in a .xls file into a data table. Created a new table with a schema that matches a database table. Then iterate through each row/column and assign the correct data to the fields of the new data-table.

The last piece is passing the data-table as a parameter to a stored proc to process to a temp table which will then get merged with the actual table in the database.

My question is (for testing purposes) how can I easily write out (or view) the contents of new data-table to verify its contents and structure before I proceed to pass onto the Stored proc?

thanks,

Upvotes: 0

Views: 253

Answers (4)

John Saunders
John Saunders

Reputation: 161821

You can use the WriteXml method.

Upvotes: 1

Jay Riggs
Jay Riggs

Reputation: 53603

If you're using Visual Studio 2005 or 2008 You can try the Data Visualizer.

It works in Visual Studio 2005/2008 and will graphically display a DataTable's contents showing edited/deleted/added cells and rows. The tool also works with DataSets, typed DataSets, DataViews and DataRows.

Upvotes: 1

CRice
CRice

Reputation: 12567

Why not check it out in the debugger? There should be a little magnifying glass icon which will display the contents of your data table (unless you are using an old Visual Studio version).

See Visualizers

Upvotes: 1

Abe Miessler
Abe Miessler

Reputation: 85116

You could just databind a GridView to your datatable and view the results there. Here is a good post that goes over doing that:

http://programming.top54u.com/post/ASP-Net-Bind-GridView-to-DataTable.aspx

In his example he manually creates all of the columns. You could probably get away with just setting AutoGenerateColumns to true and databinding.

Depending on the number of rows you are dealing with you might want to add paging.

Upvotes: 0

Related Questions