1
Reply

Bind DataRelation to DataList

jarabud

jarabud

Dec 11 2004 4:15 PM
2.4k
How do I bind datarelation to either datalist or datagrid control here what I understanded so far. SqlConnection nwindConn = new SqlConnection("Data Source=localhost;" + "Integrated Security=SSPI;Initial Catalog=Northwind;"); SqlDataAdapter custDA = new SqlDataAdapter("SELECT CustomerID, CompanyName FROM Customers", nwindConn); SqlDataAdapter orderDA = new SqlDataAdapter("SELECT OrderID, CustomerID, OrderDate FROM Orders", nwindConn); nwindConn.Open(); DataSet custDS = new DataSet("CustomerOrders"); custDA.Fill(custDS, "Customers"); orderDA.Fill(custDS, "Orders"); nwindConn.Close(); DataRelation custOrderRel = custDS.Relations.Add("CustOrders", custDS.Tables["Customers"].Columns["CustomerID"], custDS.Tables["Orders"].Columns["CustomerID"]); Thanks, Regards Jarabud

Answers (1)