Alex Bibiano González (03/17/2008)
Thanks for your replays. I will try your suggestion but I need a little more help.
I have read the link, but don't understand where to put the query in my BO:
SELECT Staff.*, SchoolTitles.TitleName FROM Staff INNER JOIN SchoolTitles ON Staff.ForeignKey = SchoolTitles.PrimaryKey
Can I retrieve in my fill method more columns than the columns I mapped in the BO mapper?
Can I create a BO with all fields as custom properties? (because my BO don't maps directly to a table, and I can't use the BO mapper tool)
Thanks and excuse for my ignorance
Alex B.
Hi Alex,
No problem, so here we go.....
- In the Solution Explorer, right click your BO file and select View Code
- Open the Region "Data Retrieval Methods" and create a method here which you will call from anywhere in your form, so let's named it something like GetStaffView and the code should be something like this in VB:
Public Sub GetStaffView() Me.FillDataTable("SELECT Staff.*, SchoolTitles.TitleName FROM Staff INNER JOIN SchoolTitles ON Staff.ForeignKey = SchoolTitles.PrimaryKey")End Sub You will then call the Me.GetStaffView method from your form's New or Load event or from any other place you want the BO to be populated.
I believe you will also need to create a Custom Field Property to manage the SchoolTitles.TitleName, but I am not sure, so if that is the case let me know to give you some code to do that, or look at the help for the Custom Field Property topic, so you can add it in the same BO file.