Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to use LINQ to SQL data source to create a Master-Detail report

$
0
0

It's possible to use LINQ to SQL API to bind an XtraReport document to data.
To set up report controls' bindings at design time, use the BindingSource component, which DataSource property is set to the parent (Master) object.
The relation between objects will be recognized automatically.
Then, use a Detail Report Band to create a Master-Detail report layout (see How to: Create a Master-Detail Report using Detail Report Bands).
In the example, Order -> Order_Detail collections (Northwind database) are used.

In addition, you can filter query results using Linq to Sql syntax.
For instance, use the following code to display a report document, containing Northwind Orders data filtered by customers, whose CustomerID starts with letter "B".

[C#]
NwindDataContextdc=newNwindDataContext();var_data=from_ordersindc.Orderswhere_orders.CustomerID.StartsWith("B")select_orders;XtraReport1report=newXtraReport1();BindingSourcebs=(BindingSource)report.DataSource;bs.DataSource=_data;
Question Comments

Added By: NoronhaJR at: 10/18/2012 6:44:40 AM    

Gostaria de fazer isso usando Aplicação Web? Como faço para realizar a conexão utilizando LINQ?

Added By: NoronhaJR at: 10/18/2012 6:45:02 AM    

I would like to do this using Web Application? How do I make the connection using LINQ?

Added By: pangeran thoha at: 12/4/2012 5:54:59 PM    

i got this message "Unable to cast object of type 'WindowsFormsApplication3.depnakerDataSet' to type 'System.Windows.Forms.BindingSource'."
 while casting report.DataSource (dataset) to BindingSource => BindingSource bs = (BindingSource)report.DataSource;
did i miss something?

Added By: mostafa alaa at: 8/3/2014 6:31:24 AM    

Unable to cast object of type 'WindowsFormsApplication3.depnakerDataSet' to type 'System.Windows.Forms.BindingSource'.

what can i do ??

Added By: Ingvar (DevExpress Support) at: 8/4/2014 2:07:22 AM    Mostafa,

Please create a separate ticket and provide us with a sample project there.

Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>