Click here to Skip to main content
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 18: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)



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