VB2019 VB2017 VB2015 VB2013 VB2012 VB2010 VB2008 VB6 VB Sample Code 中文VB About Us

Lesson 29 : Creating a Database Application

29.1 Introduction to Database

Every day we come across many types of information. Some examples are names, addresses, money, date and stock quotes. A professional handles even more data. For example, a doctor needs to keep track of patients’ personal and medical information. The information includes names, addresses, phone numbers, blood pressure readings, blood sugar readings, surgical history, medicines prescribed in the past and more. On the other hand, businesses have to manage a large amount of data pertaining to products and customers. All these data need to be organized into a database for the ease of data management.

In the past, people typically deal with data manually like using cards and folders. However, in present day fast paced global environment and Information age, it is no longer feasible to manage data manually. Most data are now managed using computer-based database management systems.

Computer-based Database management systems handle data much faster and more efficient than human beings do. With the advent of the network and the Internet technologies, data can now be managed locally and remotely. Database management systems are used in running payroll system, inventory system, accounting system, payment system, order handling system, customer relationship management system(CRM) and more. Some of the commercial database management system(DBMS) are Oracle, Microsoft SQL server, and Microsoft Access

29.2 Creating a Database Application in Visual Basic 2010

A database management system typically deals with storing, modifying, and extracting information from a database. It can also add, edit and delete records from the database. However, a DBMS can be very difficult to handle by ordinary people or business men who have no technological backgrounds. Fortunately, we can create user-friendly database applications to handle the aforementioned jobs with the DBMS running in the background. One of the best programs that can create such database application is none other than Visual Basic 2010.

Visual Basic 2010 uses ADO.NET to handle databases. ADO.NET is Microsoft’s latest database technology which can work with many other advanced database management systems such as Microsoft SQL server. In this Lesson, we will develop codes that make use of Microsoft SQL Server 2008, therefore you need to have Microsoft SQL Server 2008 installed on your PC, otherwise, you can download it from http://www.microsoft.com/en-us/download/details.aspx?id=1695. Besides, you might want to download Microsoft SQL Server 2008 Management Studio Express, the SQL database management system that allows you to create and manage databases.

To begin building the database project in Visual Basic 2010, launch Visual Basic 2010. You can name your project as Database Project 1 or whatever name you wish to call it. Next, change the default form’s Text property to Contacts as we will be building a database of a contact list. There are a few objects in ADO.NET that are required to build the database. There are:

The aforementioned objects belong to the System.Data and the System.XML namespace. Therefore, we have to reference them in the beginning before we can work with them. To reference the ADO.NET object, choose project from the menu then select Database Project 1 properties to display the project properties. Next click the References tab to show the active references for the project, as shown in Figure 29.1

Visual basic 2010

Figure 29.1

Under imported namespaces, make sure system.data, System.Data.Sqlclient is selected, otherwise, check them. Having done that you need to click the Save All button on the toolbar and then return to the Visual Basic 2010 IDE.

We shall proceed to create the connection to the database source file in the next Lesson.

❮ Previous Lesson

Copyright©2008 Dr.Liew Voon Kiong. All rights reserved |Contact|Privacy Policy