-3
<b><%# DataBinder.Eval(Container.DataItem, "Hotel_FloorId")%></b>
<b><%# DataBinder.Eval(Container.DataItem, "Hotel_FloorName")%></b>
<br>
<asp:repeater id="childRepeater" runat="server" datasource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows ("myrelation") %>' >
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem, "[\"RoomDoorNo\"]")%><br>
</itemtemplate>
</asp:Repeater>
</itemtemplate>
protected void Page_Load(object sender, EventArgs e)
{
string css = ConfigurationManager.ConnectionStrings["CS"].ConnectionString;
SqlConnection cnn = new SqlConnection(css);
cnn.Open();
SqlDataAdapter cmd1 = new SqlDataAdapter("SELECT * FROM HM_Hotel_Floor", cnn);
DataSet ds = new DataSet();
cmd1.Fill(ds, "Floors");
parentRepeater.DataSource = ds.Tables["Floors"];
SqlDataAdapter cmd2 = new SqlDataAdapter("select * from HM_Rooms", cnn);
cmd2.Fill(ds, "Rooms");
ds.Relations.Add("myrelation", ds.Tables["Floors"].Columns["Hotel_FloorId"], ds.Tables["Rooms"].Columns["Hotel_FloorId"]);
Page.DataBind();
}
錯誤是編譯器錯誤消息:CS0246:類型或命名空間名稱「DataRowView的」不能發現(你是否缺少使用指令或裝配參考?)
請任何一個幫我
添加這個命名空間'使用System.Data;' – 2014-09-22 07:44:33