VB .Net 2010 - working with MS Access 2007 Data-Base - released 2012 - Parts available (2)
- In the book; the photos show how to start your project, how to select your database and how to display it. Here, we'll discuss each photo and explain each code block.
- Photo (1) : Shows the folder that contains the project, the (My-First-Con.vbproj) is the icon you need to click to open the project.
- Photo (2) : From menu (Data) choose (Add New Data Source), a popup dialog-box will show titled (Choose a Data Source Type) and you select (Database) as long as we are connecting to one, then click next.
- Photo (3) : A popup dialog-box appears titled (Data Source Configuration) and you select (DataSet). The DataSet is the connection type we are trying to establish here, click next. Also in the end you will notice a file (DataSet) was created, let's not rush, ok?!
- Photo (4) : Another dialog-box shows up titles (Choose Your Data Connection), here we'll choose (New Connection) and another dialog-box will show up to choose the connection from it, this new dialog-box titled (Add Connection) has (Change) button and (Browse) button, we will click on (Change) to choose the data source we wish to work with, as for this lesson we're working on (Access) so we will choose access from the next popup window that will show when we click on (Change) which called (Microsoft Access Database File), the other databases are for the other types of databases, now choose (Access) and there will be another button below called (Data Provider) which provides us with the technology we wish to work with, as for here we will work with (.Net Framework Data Provider for Ole DB), then we click next.
Continue reading and download (Part1)
- The General Declaration Code
We called two liberaries
(System.Data.OleDB) and (System.IO) The System.Data.OleDB Liberary is the.Net Frame-Work 4 (VB .Net 2010's Environment) Data Provider for the OLEDB, it calls the database Jet Engine installed on the machine to work with it inside your VB .Net 2010 Project Application, it's a link between our (Access DB) and our (VB .Net 2010 Project).
We will use its classes to connect to the database and retrieve\store data from\into it.
The System.IO Liberary is all the classes and procedures needed to work with files like reading, writing and storing including Stream Files like Sound Files, Images Files and Binaries.
We'll use its classes later when working with storing photos into database and retrieve it from there into form's control [Picture-Box].
- Public Class Form1 Page (3)
PicLocation is a string used to locate the photo and we'll use it later in next chapter when working with photos.
Ctrl1, Ctrl2 are controls used to refer to the TextBoxes and the PictureBox in the Sub ClearAll() in order to clear them.
CN OleDBConnection is a class used to connect to the database path in the connection string which we will provide.
Continue Reading and download (Part 2)