Welcome to Dream.In.Code
Click Here
Getting C++ Help is Easy!

Join 118,858 C++ Programmers for FREE! Ask your question and get quick answers from experts. There are 1,647 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Dynamic DataSource

 
Reply to this topicStart new topic

Dynamic DataSource, Creating a dynamic datasource.

linuxunil
post 18 Jul, 2008 - 01:25 PM
Post #1


New D.I.C Head

Group Icon
Joined: 7 Mar, 2006
Posts: 46



Thanked 2 times

Dream Kudos: 125
My Contributions


I have a windows form that contains a ListBox and a DataGridView that are bound to a database the the wizard. The ListBox contains a list of all of the tables in my database loaded through a custom view. The datagrid view defaults to a certain table. I am trying to figure out a way to change the DataGridView based on what is selected in the ListBox, but I would like to keep this dynamic since the tables in the database may change at anytime. I looked for some sort of introspection like Pythons getattr(), but couldn't find one. A
User is offlineProfile CardPM

Go to the top of the page


skaoth
post 19 Jul, 2008 - 03:32 PM
Post #2


D.I.C Regular

Group Icon
Joined: 7 Nov, 2007
Posts: 336



Thanked 8 times

Dream Kudos: 100
My Contributions


How about creating a stored procedure that takes as input the name of one of the tables. Then bind the datagridview to a dataset object that gets returned from the stored procedure.
User is offlineProfile CardPM

Go to the top of the page

linuxunil
post 21 Jul, 2008 - 08:50 AM
Post #3


New D.I.C Head

Group Icon
Joined: 7 Mar, 2006
Posts: 46



Thanked 2 times

Dream Kudos: 125
My Contributions


I have a dataset that represents the data base, and have the DataGridViews BindingSource set to a table adapter filled from one of the datasets tables. I just want to be able to change which table it is being filled from. I'm trying to make it so that it can adapt to database changes without needing the code to be changed. And keep it easy to maintain since I am not the that has to.
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 10/13/08 01:37AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month