How to connect to an Access 2007 database?
Hello,
I have decided to make a little "safebox", to store some important information. For some reason I have decided to use a database (even though I have never used it!), so I would like if someone could help me connect to the database.
I'm not asking for the code (I won't complain if you post it :p), but a couple of advices on how to do this or maybe links will be HIGHLY APPRECIATED!
Thanks in advance!
For some reason, I think I'm connected to the database... Here's a screen capture:
Am I connected?
Am I?
Re: How to connect to an Access 2007 database?
Go to the Database Development forum and read the FAQ thread at the top and follow the .NET links from there. There's a tutorial from mendhak and code examples from myself so you shouldn't need much more than that for a while at least.
Re: How to connect to an Access 2007 database?
What's the difference about doing what wrote on his post and creating a datasource via the designer?
Re: How to connect to an Access 2007 database?
Creating a Data Source generates a typed DataSet. This means that you can do things like this:
vb.net Code:
Dim firstName As String = myDataSet.Person(0).FirstName
instead of this:
vb.net Code:
Dim firstName As String = myDataSet.Tables("Person")(0)("FirstName")
It also means that the system will generate the SQL code and wrap in TableAdapters for you instead of your having to create the connections and data adapters yourself.
It also means that you can drag tables and/or columns from the Data Sources window onto your form to automatically create controls and the associated components. For instance, if you drag a table from the Data Sources window it will automatically generate a DataGridView, BindingSource, BindingNavigator, DataSet and TableAdapter as well as the data-bindings and some skeleton code.
The Data Source wizard does a lot of work for you and makes the rest of your work easier. Some people don't like that responsibility being taken out of their hands though.
Re: How to connect to an Access 2007 database?
Wow. Umm, ok. So, should I use the wizard? (For learning purposes).
Re: How to connect to an Access 2007 database?
Quote:
Originally Posted by
tassa
Wow. Umm, ok. So, should I use the wizard? (For learning purposes).
That depends on what you want to learn. If you want to learn how to create an application that makes use of data then you should, because it means you can concentrate on that without worrying too much about how you get and save the data. If you want to learn the ins and outs of how you get and save data though, then maybe you shouldn't.
Ideally we would use the tools that can make our life easier when they can do what we want but we would also understand what it is that these tools are doing for us. You have to know what a DataAdapter is and how it works to truly understand how a TableAdapter works, but if all you care about is the data that the TableAdapter will get and save then knowing how a DataAdapter works is no real help. It's up to you how deep you go and when.
Re: How to connect to an Access 2007 database?
Well, I guess I'll give it another try tomorrow. Thanks for the input ;).