Normally, when populating controls with data from a database I create a connection and then pass a SQL statement to create a DataReader. I then loop through the DataReader and populate the controls. Because I am creating the SQL statement on the fly I can query the database joining on multiple tables to get just the columns and rows I need.
Now I'm trying to use the Data Repeater control in VS 2010. The Data Repeater is part of the Visual Basic Power Pack add on. If you don't have it, it is similar to the Data Grid. I've never used the data grid because I found it lacking. I need more control on how to display the data. The data repeater seems as though it will work in this particular instance.
So, following the numerous on-line tutorials I created a new data source and a new dataset using the wizards. I pointed the dataset to a table in my data source and then bound the dataset to the data repeater. It works, but the dataset is bound to a table. I can think of very few instances where I would need to dump the data from a table on to form. I need to be able to query the table(s).
I need to be able to pass a SQL statement to the dataset at run-time. This could be a query that had multiple joins in it. It would only need to be read-only. It needs to be able to retain the bindings to the controls or I need to be able to bind the controls at run-time.
No property jumps out at me for changing the dataset SQL statement at run-time. I can't see how to bind controls on the data repeater atrun-time. I can bind a data set to a data repeater at run-time, but I can't figure out how to bind the controls to the dataset fields at run-time.
Any help is appreciated.
Greg