<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<script language="VB" runat="server">
     Sub Page_Load(sender As Object, e As EventArgs) 
	Dim dv as DataView
	Dim i as integer
	Dim myConnection As OleDbConnection
	Dim myCommand    As OledbDataAdapter
	Dim ds           As New DataSet
	Dim ConnStr      As String
	Dim SQL          As String
	ConnStr = "Provider=SQLOLEDB; Data Source=(local); Initial Catalog=ASPNET;User ID=sa;"
	myConnection = New OleDbConnection(ConnStr)    
	SQL = "select  * from groups where code_value = 700 "
	myCommand = New OleDbDataAdapter(SQL, myConnection)
	myCommand.Fill(ds, "groups")
	
	dv = new DataView(ds.Tables("groups"))
	   Dim t As DataTable
	   t = dv.Table
	   Dim r As DataRow
	   Dim c As DataColumn
	   Dim _cell as TableCell
	   Dim _row as TableRow
	   table = New Table()
           Controls.Add( table )	
	  
	  For Each r in t.Rows
	     For Each c in t.Columns
	        _row = new TableRow()   '<tr>      
	        'Label
	        _cell = new TableCell()  '<td>
	        _cell.Controls.Add(new LiteralControl(c.ToString))
                _row.Cells.Add(_cell) '</td>
	        
	        'Value
	      	_cell = new TableCell()  '<td>
	      	_cell.Controls.Add(new LiteralControl(r(c).ToString))
                _row.Cells.Add(_cell) '</td>
	      	
	      	Table.Rows.Add(_row)	'</tr>
	     Next c
	   Next r
	end sub
</script>


<h2> DataTable µÄÐÐºÍÁÐ</h2>
<body style="background-color='beige'; font-family='verdana'; font-size='10pt'">
<form runat = "server">
<asp:Table id="Table" Font-Name="Verdana" Font-Size="8pt" CellPadding=5 CellSpacing=0 BorderColor="black" BorderWidth="1" Gridlines="Both" runat="server"/>
</form>
</body>

</html>

