DataTable Viewer?

  • Thread starter Thread starter John Dalberg
  • Start date Start date
J

John Dalberg

Is there a tool to view contents of datasets or datatables visually?
 
Hi John,

You can turn the DataTable into an XML file by using the DataSet's WriteXml
method. After that, you can open the XML file in Visual Studio's XML Data
editor which gives a graphical interface for editing.

Here's a way to turn the table data into an XML file. Let us know if this is
what you meant?

Ken
Microsoft MVP [ASP.NET]


<%@ Page Language="VB" %>

<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim dt As DataTable
Dim ds As New DataSet
dt = CreateDataSource()
ds.Tables.Add(dt)
ds.WriteXml("c:\dsvis.xml")
End Sub
Function CreateDataSource() As DataTable
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add(New DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New DataColumn _
("CurrencyValue", GetType(Double)))
dt.Columns.Add(New DataColumn _
("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 4
dr = dt.NewRow()
dr(0) = i
dr(1) = "Item " + i.ToString()
dr(2) = 1.23 * (i + 1)
dr(3) = (i = 4)
dt.Rows.Add(dr)
Next i
Return dt
End Function 'CreateDataSource


</script>

<html>
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Open
c:\dsvis.xml"></asp:Label>
</div>
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top