Trying to bind to an XtraReport


Author
Message
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hya.

I am trying to bind an XtraReport label to a BO field.

Does our BO implements the IList, ITypedList or IBindingList interface? That's what the XtraReport asks me in the help file.

I get an error after I set the report DataSource to the BO :

Private Sub RelEmpresasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RelEmpresasToolStripMenuItem.Click

Dim Report As New rptEmpresas()

Dim loEmpresas As New ProFilmeNET_BOL.boEmpresas()

loEmpresas.FillDataTable("Select * from Empresas")

Report.DataSource = loEmpresas

Report.lblNome.DataBindings.Add("Text", loEmpresas, "emp_Descr")

Report.ShowPreviewDialog()

End Sub

Any word of advice to direct me in the right direction will be appreciated.

Thanks in advance.


Replies
Paul Chase
Paul Chase
Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)Advanced StrataFrame User (806 reputation)
Group: Forum Members
Posts: 414, Visits: 2.8K
Ivan,

I have been struggling with the concept of how I want to deal with Reports and Data Access for the last few days and I can't seem to decide how best to implement it.

I guess it would be nicer to have all the data access come from a bus object library. But at the same time with joined queries for reporting it makes it a bit trickier. I guess you would have to create a view and base a bo off the view.

At the same time it is simple enough to create the typed DS right in the report. but you need watch connection strings etc.

I guess it really doesnt matter.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Well if it were me I would not venture too far from the business objects.  You can create any type of JOIN query from within a BO to return any fields that you want.  You can create a view, as you mentioned, to pull back all of the fields you want in a flat format.  If you need to create custom fields or a BO that supports a special DDT layout and then your FillDataTable(...) method pulls data using the inner join, you can.  When you start dealing with typed data sets you are heading for frustrations the first time you want to make a change.  There are a lot of different ways to "skin the cat" so to speak...but you also want to make sure that you are not painting yourself into a corner down the road.

Any of these options, including the typed data set, will work.  But when you start pulling connection strings and talking directly to the data you are breaking encapsulation so if some day you want to change your back end...including the Middle Tier Enterprise Server, your reports will break.  If you work inside the confines of the business object you can change your backend database or connect to the Enterprise Server interchangeably without having to change this code.

Note: Any custom connection you make outside of the logic of the framework will prevent the data access layer from being interchangable without having dramatic side-effects within your application...this includes the Middle Tier Enterprise Server that will be released by the end of the year.

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)Strategic Support Team Member (4.9K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi guys.

Trent L. Taylor (10/13/2006)
Well if it were me I would not venture too far from the business objects. 

This is exactly what I keep in mind. I realize there's a whole attention built inside the BOs, and for a start I want to take advantage of not having to worry about it. And then, there's the back end, and the Middle Tier. I will stick to the BOs.

You can create any type of JOIN query from within a BO to return any fields that you want.  You can create a view, as you mentioned, to pull back all of the fields you want in a flat format.  If you need to create custom fields or a BO that supports a special DDT layout and then your FillDataTable(...) method pulls data using the inner join, you can.

This is where I need to get proficiency at. But seeing you say it is possible, is already a good incentive.

So, Paul, I think we will be safer under the wings of the BOs. Guess we just have to find our way in it.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Ivan George Borges - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Ivan George Borges - 19 Years Ago
Ivan George Borges - 19 Years Ago
                     Glad you got it working, Ivan :)
StrataFrame Team - 19 Years Ago
Paul Chase - 19 Years Ago
Ivan George Borges - 19 Years Ago
Paul Chase - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Ivan George Borges - 19 Years Ago
Paul Chase - 19 Years Ago
StrataFrame Team - 19 Years Ago
Paul Chase - 19 Years Ago
StrataFrame Team - 19 Years Ago
Ivan George Borges - 19 Years Ago
                         Hehe, no questions are stupid, that's for sure... and yes, you have it...
StrataFrame Team - 19 Years Ago
                             Hey, Paul. I did the changes you mentioned before to get the BO...
Ivan George Borges - 19 Years Ago
                                 Yeah I havent figured out how to make that work.. Dont hit HTML it...
Paul Chase - 19 Years Ago
                                     too late ...:D
Ivan George Borges - 19 Years Ago
                                         Ben, I understand what you are saying about using a temp table to...
Paul Chase - 19 Years Ago
                                 Hi Ivan, I'm also having problems dropping a BO onto the report...
Tim Dol - 19 Years Ago
                                     Tim you need to manually assign the bus object to the binding source...
Paul Chase - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search