Click here to Skip to main content
15,921,250 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I want to bind a gridview to multiple tables.
scenario:
I have a gridview and three database tables, and now what i want is three columns in my gridview each column should be coming from different table.
Posted

You can use this statement in your Query

SQL
SELECT c.Email, o.OrderTotal, orn.Note FROM tblCustomer c
INNER JOIN tblOrder o ON c.CustomerID = o.CustomerID
INNER JOIN tblOrderNote orn on o.OrderID = o.OrderID
 
Share this answer
 
As I getting you want o display Column datas from three different table in to one Gridview if so then you can use JOIN to bind data from multiple table to one gridview or even you can also use Merge method of Datable where Merge method is used specified DataTable with the current DataTable. otherwise
Try
Multiple Tables in one DataGridView[^]
 
Share this answer
 
HI arvind you have a query that states that select c,Email,o.Order.total.i gacve compleare the mainnptri so ckim 9).
 
Share this answer
 
hi,


Thanks to all for replying, the links provided by thatraja are very helpful to meet my requirement.
 
Share this answer
 
Hello sir,
Thank you for replying ..

would u pls provide some sample code in c#...

THANKS IN ADVANCE...
 
Share this answer
 

<pre><pre><pre><pre><pre><pre><code><code><code><code><code><code><code><code><code></code></code></code></code></code></code></code>code><pre><pre><pre><pre><pre>jj<pre><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small><small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small></small>
de>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900