学院首页>网络编程>ASP.NET>ASP.NET 中的 hash 表操作

ASP.NET 中的 hash 表操作

作者:豆腐技术站 来源:http://www.asp888.net 添加时间:2006-5-21 10:47:36
 本文介绍了ASP.NET中的矢量集合Hashtable使用方法,并附有代码 
/*
豆腐制作 都是精品

如转载 请保留版权信息 。
*/
Hash 表是一组包含有Key 和 Value 数据 的表,我们可以通过 下面的这个例子 看看如何操作Hashtable
<html> 
<head> 

<script language="VB" runat="server"> 
Sub Page_Load( s As Object, e As EventArgs ) 
If Not IsPostBack Then 
Dim myHash As New HashTable() 
myHash.Add( "ASP+", "1" ) 
myHash.Add( "COM+", "2" ) 
myHash.Add( "ADO+", "3" ) 
myHash.Add( "C#", "4" ) 
MyRepeater.DataSource = myHash 
MyRepeater.DataBind 
End If 
End Sub 
</script> 

</head> 
<body> 

<h3>请看这是一个在 DataSet 上绑定一个 哈稀表 的操作代码</h2> 

<form runat=server> 

<asp:Repeater id="MyRepeater" runat="server"> 

<template name="itemtemplate"> 

 
<%# Container.DataItem.Key %> : 


<%# Container.DataItem.Value %> 
</template> 

</asp:Repeater> 

</form> 

</body> 
</html> 
站内搜索