TreeView (2/3)
•DataSet GetData()
•{
–SqlConnection conn = new SqlConnection(conexao);
–string sqlCat = "Select CategoryID, CategoryName FROM Categories";
–string sqlProd = "Select CategoryID, ProductName FROM Products";
–SqlDataAdapter daCat = new SqlDataAdapter(sqlCat, conn);
–SqlDataAdapter daProd = new SqlDataAdapter(sqlProd, conn);
–DataSet ds = new DataSet();
–daCat.Fill(ds, "Categories");
–daProd.Fill(ds, "Products");
–ds.Relations.Add("Children",
•ds.Tables["Categories"].Columns["CategoryID"],
•ds.Tables["Products"].Columns["CategoryID"]);
–return ds;
•}