Load or Connect to DB Dialog VB 2010
Does anyone know if you can create a dialog on the vb form to connect to a ms access 2007 db locally?
I am creating a app to analyze databases for duplicate data for multiple projects. For example, I might have 10 different access databases to analyze individually and I would like to choose them from a dialog control if possible. After the connection is made I will then proceed to run the query from the button click event and spit out the resulting data into a separate winform.
I am not sure if a openfiledialog could be used but any direction to tutorials, etc. would help.
Re: Load or Connect to DB Dialog VB 2010
You can use a FILEDIALOG to choose the table to use, but there isn't an easy way to open a connection to each table, or even run a query. You can use Access to do that, though
Re: Load or Connect to DB Dialog VB 2010
Openfiledialog should work fine. You just need to get the filename from the dialog and modify your connection string accordingly with the selected filename then open the db as usual.
Been a while since I tried to check out the structure of a mdb via vb but if memory serves there used to be a way to access the collection of tables in the db and you could retrieve the names and other properties of the tables.
Re: Load or Connect to DB Dialog VB 2010
Re: Load or Connect to DB Dialog VB 2010
Quote:
Originally Posted by
dglienna
LINQ to SQL should work
To browse to an Access database?
I was refering to the old DAO methods before, not sure if any of those carried over into ADO or ADO.Net Some of the DAO features were very useful like the seek function on the table object for example was extremely fast once the table had been loaded.
Sounds like the OP just needs to change the active database and if so a file dialog is all that is needed.
Re: Load or Connect to DB Dialog VB 2010