最近学习数据绑定,写的代码如下
<%@ Page Language= "VB " %>
<%@ Import Namespace= "System.Data "%>
<%@ Import Namespace= "System.Data.sqlClient "%>
<%@ Import Namespace= "System.Data.OleDb "%>
<script runat= "server ">
Sub Page_load(ByVal sender As Object, ByVal e As EventArgs)
Dim objConnection As OleDbConnection = New OleDbConnection( "Provider=Microsoft.Jet.OleDb.4.0;Data Source= " + Server.MapPath( "~/App_Data/wgq.mdb "))
Dim objCommand As OleDbDataAdapter = New OleDbDataAdapter( "select * from 汇总表 ", objConnection)
Dim ds As DataSet = New DataSet()
objCommand.Fill(ds)
Repeater1.datasource = ds
Repeater1.databind()
End Sub
</script>
<head runat= "server ">
<title> 无标题页 </title>
</head>
<body>
<form id= "form1 " method= "post " runat= "server ">
<div>
<asp:Repeater ID= "Repeater1 " runat= "server ">
<ItemTemplate>
<%Databinder.eval(Container.Dataitem, "1 ") %> <br>
</ItemTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>
运行出错,显示未声明名称“container”,不知道如何解决
------解决方案--------------------------------------------------------
<%#DataBinder.Eval(Container.DataItem, "1 ")%>