Click here to Skip to main content
11,408,708 members (64,932 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
i have tables database
1- payout_transcation
2- payout_master
i want data from both this tables in a single gridview or datagrid

can i do that...
Posted 30-Jan-13 19:43pm
Comments
Nandakishorerao at 31-Jan-13 0:55am
   
form a view of both the tables and bind it to the gridview.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Hi friend,

yes you have to join to table(that you want to saw on grid) and then bind them to data grid view.
  Permalink  
Comments
Marcus Kramer at 23-Feb-13 11:30am
   
My 1. Repost of Solution 1
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Join the 2 tables and bind the result to your grid view.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

How these tables are related... means relationship

if the payout_transcation table contains Forienkey relationship from payout_master, then
1) write a query joining 2 tables. Then bind the resultset to DataGrid or GridView
or
2) Create a view on both table and then query the view and bind the resultset to DataGrid or GridView

Please find the following query for sample
SELECT PT.*, PM.* FROM payout_transcation AS PT INNER JOIN payout_master AS PM ON PT.<forienkey> = PM.<primaykey>
</primaykey></forienkey>
Hope it helps you
Happy Coding Smile | :)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["conString"]);

SqlDataAdapter da = new SqlDataAdapter("select * from payout_transcation,payout_master", con);
        DataSet ds = new DataSet();
        da.Fill(ds);
        grv.DataSource = ds;
        grv.DataBind();
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hello Sumit,

You can use Join to fetch the data from two tables

Go To : SQL Join

Hope it will help you.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 390
1 Sergey Alexandrovich Kryukov 294
2 Maciej Los 155
3 PIEBALDconsult 140
4 Peter Leow 140
0 Sergey Alexandrovich Kryukov 8,626
1 OriginalGriff 6,855
2 Maciej Los 3,322
3 Abhinav S 3,238
4 Peter Leow 3,034


Advertise | Privacy | Mobile
Web02 | 2.8.150414.5 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100