How to retrieve data from two tables

Oct 6 2009 7:18 AM

hai...expert....plz help me
i want to retrieve data from two tables and the result should be displyed in datagrid..i have used the following code...But its not working correctly...
OleDbDataAdapter ad = new OleDbDataAdapter("Select Voucher_no,TRANS_From,TRANS_To from Stock_Transfer_Master", con);
DataSet ds = new DataSet();
ad.Fill(ds,
"Stock_Transfer_Master");
ad.SelectCommand =
new OleDbCommand("select Item_Code,Item_Name,Qty,Amount from Stock_Transfer_Details", con);
ad.Fill(ds,
"Stock_Transfer_Details");
dataGridView1.DataSource=ds;
dataGridView1.DataMember = ds.Tables[0].ToString();
dataGridView1.DataMember = ds.Tables[1].ToString();
 
thanks in advance..........

Answers (2)