http://expert.csdn.net/Expert/topic/2524/2524799.xml?temp=.2042658
在这里有个和你的要求类似的

解决方案 »

  1.   

    看看,这就是你想要的:
    <%@ Page Language="vb" Debug="true" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OleDb" %><script language="VB" runat="server">
    dim MyConnection as OleDbConnection
    dim cmdSelect as OleDbCommand
    dim dtrReader as OleDbDataReader
    Sub Page_load(sender as object,e as Eventargs)
        MyConnection = New OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=c:\inetpub\wwwroot\nhonline\datagrid\kk.mdb")
        if not IsPostBack() then
        Mydatagrid_DataBind()  
    end if
    End SubSub Mydatagrid_DataBind()
        Dim MyCommand As OleDbDataAdapter = new OleDbDataAdapter("select * from [class]", MyConnection)
        Dim DS As DataSet = new DataSet()
        MyCommand.Fill(DS,"board") 
        BigClassList.DataSource=DS.Tables("board").DefaultView
        BigClassList.DataBind()
    End SubFunction SmallClass(BigClassID) as DataTable
     dim SmallClassData as DataSet =new DataSet()
     MyConnection.Open()
     dim DataAdapter as OleDbDataAdapter = new OleDbDataAdapter("SELECT * FROM [board] WHERE class="& BigClassID &"",MyConnection)
     DataAdapter.Fill(SmallClassData,"SmallClassData")
     MyConnection.Close()
     return SmallClassData.Tables("SmallClassData")
    End Function</script>
    <html>
    <head>
    <title>NHONLINE_BBS_INDEX</title>
    <link rel="stylesheet" href="css.css" type="text/css"> 
    </head>
    <body><form Runat="server">
    <asp:Repeater id="BigClassList" runat="server">
          <ItemTemplate>
               <TABLE style="BORDER-COLLAPSE: collapse" borderColor="#797979" BgColor="#CACACA" cellSpacing="0" cellPadding="4" width="700" height="30" align="center" border="1">         
      <TR> 
                 <TD height="35" align="left"><B>&nbsp;<FONT  COLOR="#CC0000"><%#Container.DataItem("class")%></FONT></B>
      </TD>
                   </TR>
                 </TABLE>
    <!-- ---------------------------------------------------------- -->
         <TABLE style="BORDER-COLLAPSE: collapse" borderColor="#797979" BgColor="#F9F9F9" cellSpacing="0" cellPadding="4" width="700" align="center" border="1">
         <asp:Repeater id="SmallClassList" runat="server" DataSource='<%# SmallClass(Container.DataItem("id").ToString()) %>'>
       <ItemTemplate>
                <TR>
                  <TD valign="top">
          <TABLE style="BORDER-COLLAPSE: collapse" borderColor="#797979" BgColor="#F9F9F9" cellSpacing="0" cellPadding="4" width="650" align="center" border="0">
            <TR>
              <TD width="250"><FONT  COLOR="#330099">
     <A HREF='<%#"List_5_5.aspx?BoardID="& Container.DataItem("boardid")%>'><%#Container.DataItem("boardtype")%></A> </FONT>
      </TD>
            </TR>
          </TABLE>
       </TD>
    </TR>
           </ItemTemplate>
         </asp:Repeater> 
         </TABLE>
              </ItemTemplate>
    </asp:Repeater> 
    </form>
    </body>
    </html>