Being somewhat new to VB.NET, I built a data solution by using wizards and drag-and-drop on forms. My data is in an Access DB and I opened up those tables with Server Explorer and dragged them into my dataset. I connected the tables to datagridviews. Worked like a charm.

Then I found out the project needs to be able to dynamically create tables. "No problem" I thought. I would just find out how to create a table dynamically in VB.NET to put into Access. Again, worked like a charm.

Then I realized that my method of querying the data through the use of my project's dataset won't work with these dynamically created tables because as soon as the user closes out the program, those tables are no longer a part of my dataset. Yes they still reside in the Access DB, but I don't directly query Access, I use my dataset.

Am I correctly navigating this issue logically? Should I (or is there even a way) to scrap the fixed dataset and just load all the Access tables dynamically at startup? Or is there a way to scrap the dataset altogether and just communicate directly with Access? I prefer the first option if possible because this is an extensive project and I don't want to do a major rewrite.

Thanks ahead of time!

Recommended Answers

All 3 Replies

See if [this](http://stackoverflow.com/a/10597775"How to update the Dataset to reflect an added column in the data source without deleting the adapter?") works for you.

I am not looking to make this change at design time, but rather at run time.

I guess my biggest question is this: Considering I am connecting to an Access DB and have the need to dynamically create tables, am I doing the best thing by manually creating the dataset and connecting it to Access, or is there a better way?

Not sure what you have for controls to access your data (DataAdapter, TableAdapter, etc.)
But those control types usually have a RefreshSchema() method at the same level as Fill() - that should be somewhat close to the runtime equivilant of the designer operation previously linked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.