⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 collection.aspx

📁 聊天 聊天 聊天 聊天 聊天 聊天
💻 ASPX
字号:
<%@ 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 Columns & Rows </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>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -