這是我得到「循環引用自嵌套表'firstname1'」中的錯誤。自嵌套表'firstname1'中的循環引用。 asp.net
我想要分層數據綁定。員工和他們的主管在同一張桌子上。
但它在生成Xml時發生錯誤。
using (SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["RMSConnection"].ToString()))
{
string SqlCommand = "SELECT EmployeeId,FirstName,ReportToId FROM tblEmployee";
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = new SqlCommand(
SqlCommand, con);
adapter.Fill(ds);
ds.Tables[0].TableName = "FirstName1";
DataRelation dr = new DataRelation("pageId_parentId",ds.Tables["FirstName1"].Columns["EmployeeId"], ds.Tables["FirstName1"].Columns["ReportToId"]);
dr.Nested = true;
ds.Relations.Add(dr);
}
//string s= ds.GetXml();
上面是我的代碼。 請建議。
您必須提供更多數據,因爲這些數據基本上都是從Internet示例中複製而來。堅實的問題處理依賴於更廣泛的數據基礎。 – AGuyCalledGerald 2011-04-14 14:03:22