<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<script language="VB" runat="server">
Sub readDs(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 "
	myCommand = New OleDbDataAdapter(SQL, myConnection)
	myCommand.Fill(ds, "groups")
	dv = new DataView(ds.Tables("groups"))
	'//按照code_display对视图进行排序
	dv.Sort = "code_display"
	'//通过筛选器只显示姓是Smith的顾客的视图
	dv.RowFilter = "code_value = '700'"
	for i = 0 to dv.Count -1
		Response.Write(dv(i)("code_display").ToString + " - " + dv(i)("code_value").ToString())
	next
end sub
</script>
    <body>
       <h3><font face="Verdana">DataView</font></h3>
        <form  runat=server>
	 <asp:button text="Read DataView" Onclick="readDs" runat=server/>
        </form>
    </body>
</html>

