<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.XML" %>
<html>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim dataArray(,) as string
dim i, j as integer
Dim DS As DataSet = New DataSet()
DS.ReadXml(Server.MapPath("impiegati.xml"))
dim rowCount as integer= DS.Tables(0).Rows.Count
dim colCount as integer= DS.Tables(0).Columns.Count
redim dataArray(rowCount, colCount)
for i = 0 to rowCount -1
for j = 0 to colCount -1
if DS.Tables(0).Rows(i).item(j) is DBNull.value
dataArray(i,j)=""
else
dataArray(i,j) =DS.Tables(0).Rows(i).item(j)
end if
next
next
dim r as TableRow
dim c as TableCell
for j = 0 to colCount -1
r = new TableRow()
c = new TableCell()
c.Controls.Add(new _
LiteralControl(DS.Tables(0).Columns(j).ColumnName))
c.VerticalAlign = VerticalAlign.Top
c.Style("background-color") = "#ffff00"
r.cells.add(c)
for i = 0 to rowCount - 1
c = new TableCell()
c.Controls.Add(new LiteralControl(dataArray(i,j)))
c.VerticalAlign = VerticalAlign.Top
r.cells.add(c)
next i
Table1.Rows.Add(r)
next j
End Sub
</script>
<body>
<form runat="server" ID="Form1">
<asp:Table id="Table1" BorderWidth="1px" Gridlines="Both" runat="server" BackColor="#E0E0E0" BorderColor="Gray" BorderStyle="Inset" CellPadding="1" CellSpacing="0"/>
</form>
</body>
</html>