Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid from multiple tables
Message
From
18/08/2005 12:11:44
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
18/08/2005 10:29:32
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
C# 1.1
Database:
Jet/Access Engine
Miscellaneous
Thread ID:
01041958
Message ID:
01042000
Views:
28
>I have loaded a grid with data from a single table, and would like to know what adaptations are required to use a multi-table join.
>
>What I have is something like this:
>
>
>String query = "select * from Student order by LastName";
>da = new OleDbDataAdapter(query, Cn);
>ds = new DataSet();
>da.Fill(ds, "Student");
>this.dataGrid.DataSource = ds;
>this.dataGrid.DataMember = "Student";
>
>
>Data is stored in Access. I don't think I would have trouble with the JOIN (unless Access syntax is significantly different from Visual FoxPro), but:
>
>What should I replace for "Student" in lines 4 and 6, if the query spans 2 or more tables?
>
>TIA,
>
>Hilmar.

Hilmar,
Probably you wouldn't need a join but separate fills. ie:

da1 = new OleDbDataAdapter(CustomerTablequery, Cn);
da2 = new OleDbDataAdapter(OrdersTablequery, Cn);
da3 = new OleDbDataAdapter(OrdItemsTablequery, Cn);
da1.Fill(ds, "Customer");
da2.Fill(ds, "Orders");
da3.Fill(ds, "OrdItems");
// relations here
this.dataGrid.DataSource = ds;
this.dataGrid.DataMember = "Customer";

This would create a grid with hierarchical style. Or you could create multiple grids:

this.dataGrid1.DataSource = ds;
this.dataGrid1.DataMember = "Customer";

this.dataGrid2.DataSource = ds;
this.dataGrid2.DataMember = "Customer.CustomerOrders"; // relation name

this.dataGrid3.DataSource = ds;
this.dataGrid3.DataMember = "Customer.CustomerOrders.OrdersOrdItems"; // relation name

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform