Thx for your help. but the scenario of this case has some difference with
mine. Sorry for misleading
to Many relationship. and I would like to merge it into a flat datagrid like
> Hi,
>
> Add a datarelation to link 2 tables together or 2 data relation to
> connect 3 tables. Here is a sample that uses the northwind database. I
> added Imports System.Data.SqlClient at the top of the file. I have a
> windows form with a datagrid on it. I placed this code in the form load
> event.
>
> Dim strConn As String
>
> Dim conn As SqlConnection
>
> Dim daCustomer As SqlDataAdapter
>
> Dim daOrders As SqlDataAdapter
>
> Dim daOrderDetails As SqlDataAdapter
>
> Dim ds As DataSet
>
> ds = New DataSet()
>
> strConn = "Server = " + Environment.MachineName + "\VSdotNet;"
>
> strConn += "Database = NorthWind;"
>
> strConn += "Integrated Security = SSPI;"
>
> conn = New SqlConnection(strConn)
>
> daCustomer = New SqlDataAdapter("Select * from customers", conn)
>
> daOrders = New SqlDataAdapter("Select * from orders", conn)
>
> daOrderDetails = New SqlDataAdapter("Select * from [order details]", conn)
>
> ds = New DataSet()
>
> daCustomer.Fill(ds, "Customer")
>
> daOrders.Fill(ds, "Orders")
>
> daOrderDetails.Fill(ds, "OrderDetails")
>
> ds.Relations.Add("CustomerOrder",
> ds.Tables("Customer").Columns("CustomerID"), _
>
> ds.Tables("Orders").Columns("CustomerID"))
>
> ds.Relations.Add("Order-Details", ds.Tables("Orders").Columns("OrderID"),
_
>
> ds.Tables("OrderDetails").Columns("OrderID"))
>
> DataGrid1.DataSource = ds.Tables("Customer")
>
>
>
http://www.onteorasoftware.com/downloads/multigrids.zip >
>
> Ken
>
> -----------------
>
> "norton" <nortonwong@hotmail.com> wrote in message
> news:%23KM3OE5AFHA.2820@tk2msftngp13.phx.gbl...
> Hi Everyone
>
>
> I have a DataSet with two datatables
> Say One is Customer and one is CodeTable_Country
>
> Customer Table contains a field called CustomerID, CustomerName,
CountryID,
> like
> [Customer]
> -----------------
> CustomerID
> CustomerName
> CountryID
>
>
> And the CodeTable_Country Table contains a CountryID and
> CountryDescriptions, like
> [CodeTable_Country]
> ---------------------------
> CountryID
> CountryDescriptions
>
>
> I have set the datarealtion between customer and codetable_country using
> countryID, but how can i display them in datagrid so that
> [DataGrid]
> -----------------------
> CustomerName
> CountryDescriptions
>
>
> Thx and regards,
> Norton
>
>
>