title: Binding Master Detail data to XtraReport Winforms DevExpress Programmatically
body: <p>Am trying to bind data (Master Details) to XtraReport programmatic. If <strong>Master</strong> is single data/values means <strong>XtraReport</strong> working fine. But in my case <strong>Master</strong> is  multiple data/values, here all <strong>Details</strong> data is prints on all <strong>Masters</strong>. </p>
  
  <p>eg. <strong>(Vehicle Report)</strong> - Here 1)Cars &amp; 2)Bikes are Master, Details of Cars Master is <strong>BMW, Datsun, Hyundai</strong>. Details of Bike Master is <strong>Honda, Moto, Yamaha</strong>. Now I want to print like this</p>
  
  <pre><code>Report
  
  Cars
     BMW
     Datsun
     Hyundai
  
  Bikes
     Honda
     Moto
     Yamaha
  </code></pre>
  
  <p>but it printing like this </p>
  
  <pre><code>Report 
  
  Cars
     BMW
     Datsun
     Hyundai
     Honda
     Moto
     Yamaha
  
  Bikes
     BMW
     Datsun
     Hyundai
     Honda
     Moto
     Yamaha
  </code></pre>
  
  <p>Already I place Labels in designer XtraReports. This is my code to prints data on XtraReports programmatic </p>
  
  <pre><code>private void Report1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
      {
          try
          {
              StrConnection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Properties.Settings.Default.DataPath + @"CMDB\database.mdb";
  
              string qry2 = "SELECT chequeid AS ChqBukId, chdescri AS ChqBukDesc, (SELECT bankname FROM tblBankMaster WHERE bank_id=tbchequebook.bankID) AS BankName FROM tbchequebook";
              OleDbDataAdapter adapter1 = new OleDbDataAdapter(qry2, StrConnection);
              DataSet ds1 = new DataSet();
              adapter1.Fill(ds1, "Detail");
              ds1.Tables[0].TableName = "QryBank";
              DetailReport.DataSource = ds1;
  
              XRBinding bindingBankName = new XRBinding("Text", ds1, "QryBank.BankName");
              TXE_BankName.DataBindings.Add(bindingBankName);
              XRBinding bindingchqbukame = new XRBinding("Text", ds1, "QryBank.ChqBukDesc");
              TXE_ChequeBookDesc.DataBindings.Add(bindingchqbukame);
  
              string qry4 = "SELECT chq_no, chq_date, party_name, chq_amount FROM tblchequeleafnew WHERE Status='P' ";
  
              OleDbDataAdapter adapter3 = new OleDbDataAdapter(qry4, StrConnection);
              DataSet ds3 = new DataSet();
              adapter3.Fill(ds3, "Detail2");
              ds3.Tables[0].TableName = "QryCheque";
              DetailReport1.DataSource = ds3;
  
              XRBinding bindingChqNo = new XRBinding("Text", ds3, "QryCheque.chq_no");
              TXE_ChequeNo.DataBindings.Add(bindingChqNo);
  
              XRBinding bindingChqDate = new XRBinding("Text", ds3, "QryCheque.chq_date", "{0:MM/dd/yyyy}");
              TXE_ChequeDate.DataBindings.Add(bindingChqDate);
  
              XRBinding bindingPartyName = new XRBinding("Text", ds3, "QryCheque.party_name");
              TXE_PartyName.DataBindings.Add(bindingPartyName);
  
              XRBinding bindingChqAmt = new XRBinding("Text", ds3, "QryCheque.chq_amount", "{0:N2}");
              TXE_ChequeAmount.DataBindings.Add(bindingChqAmt);
  
          }
          catch (Exception ex)
          {
              XtraMessagebox.Show(ex.message.tostring());
          }
      }
  </code></pre>
  
  <p>This is my XtraReport</p>
  
  <p><img src="https://i.stack.imgur.com/cMnAe.png" alt="XtraReport"></p>
  
  <p>How to solve this to get exact Master &amp; Its Details. Using this above code am getting Master exactly, but it show all details under all masters.</p>