日期:2014-05-18  浏览次数:20444 次

repeater嵌套问题(asp.net)
使用repeater嵌套,报错为 “服务器标记的格式不正确。”,不知正确的如何写


'################   Begin:   repeater.aspx.vb   ##########################
Imports   System.Data
Imports   System.Data.SqlClient
Imports   system.configuration


Partial   Class   repeater
    Inherits   System.Web.UI.Page

    Public   conn   As   New   SqlConnection()
    Public   Const   ConnectionString   As   String   =   "Data   Source=(local);   Initial   Catalog=Cla;   UId=sa;   Pwd=password "
    Public   cmd   As   SqlCommand
    Public   sql   As   String

    Protected   Sub   Page_Load(ByVal   sender   As   Object,   ByVal   e   As   System.EventArgs)   Handles   Me.Load
        conn.ConnectionString   =   ConfigurationManager.ConnectionStrings( "DSN_J_Cla ").ConnectionString

        Dim   strSql   As   String

        Dim   da   As   New   SqlDataAdapter()
        Dim   ds   As   New   DataSet()

        '##################begin:得到目录####################################
        sql   =   "select   contentsid,name   from   contents   where   magazineID=8   order   by   contentsindex "
        da   =   New   SqlDataAdapter(sql,   conn)

        ds.Clear()
        da.Fill(ds,   "contents ")

        sql   =   "select   articleid,   contentsid,name,ename,subhead,esubhead,au_search,istop   from   article   order   by   ArticleIndex "
        da   =   New   SqlDataAdapter(sql,   conn)


        da.Fill(ds,   "article ")

        '创建   Authors   表和   Titles   表之间的关系.
        ds.Relations.Add( "myrelation ",   ds.Tables( "contents ").Columns( "contentsid "),   ds.Tables( "article ").Columns( "contentsid "))

        rpContents.DataSource   =   ds.Tables( "contents ")
        rpContents.DataBind()

        '##################E   N   D:得到目录####################################

        conn.Dispose()
    End   Sub
End   Class
'################   End:   repeater.aspx.vb   ##########################


'##################   Begin:   repeater.aspx   ##########################
<%@   Page   Language= "VB "   AutoEventWireup= "false "   CodeFile= "repeater.aspx.vb "   Inherits= "repeater "   %>


<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 无标题页 </title>
</head>
<body>