This sample shows how to retrieve any arbitrary data (i.e. could be completely unrelated to the BO being used) using a BusinessObject.
The FillDataTable method of the base BusinessLayer class can execute any arbitrary SQL (or a SqlCommand object) and the BO will be loaded with the retrieved data, into a ADO.NET DataTable, referenced via the CurrentDataTable property of the BO. When answering a question on the forum (
http://forum.strataframe.net/FindPost26703.aspx) I incorrectly thought that using a generic BusinessLayer object would do the trick. Unfortunately, the BusinessLayer is not ready for use, as it requires server properties to be overloaded. This sample shows how to use any mapped BO (thus all the properties are overridden) to get any data needed from the any table required.
This method can be used with EnterpriseServer. For applications that use direct connections to a database, they normal ADO.NET methods can be used when necessary. However, when using ES, this type of strategy will not work. This can be used when needed to get the job done.
The sample will prompt you to connect to a database via the normal SF connection wizard. The sample SQL provided uses the StrataFrameSample database and is designed to query the Customers table. Clicking on the Set Enterprise Connection button will allow you to connect to an ES server to test how it works against an ES server. The GenericBO is mapped to the Customers table form the StrataFrameSample database. However, you can use it to query completely different databases.
This also shows how to setup a listview to display the results, including setting the populations settings and configuring the columns based on the current data table in the BO.
Comments are always welcome. Enjoy!