HANOI INDUSTRIAL COLLEGE OF TECHNOLOGY
Author
Vu Thi Kim Phuong Bui Quang Ngoc
Maybe you are interested!
-
Database Programming - Hanoi Industrial Vocational College - 22 -
Database Programming - Hanoi Industrial Vocational College - 14 -
Database - Hanoi Industrial College - 2 -
Practice database programming with VB.net - 39 -
SQL Database Administration - Hanoi University of Business and Technology - 14
COURSE BOOK
DATABASE PROGRAMMING
(Internal circulation)
Hanoi 2011
Copyright Statement
This textbook is used as internal teaching material in Hanoi Industrial Vocational College.
Hanoi Industrial Vocational College does not use and does not allow any individual or organization to use this textbook for business purposes.
Any citation or use of this textbook for other purposes or elsewhere must have written consent from Hanoi Industrial Vocational College.
Chapter 1
OVERVIEW OF PROGRAMMING WITH VISUAL BASIC .NET LANGUAGE
OBJECTIVES OF THE CHAPTER
- About knowledge
Introduces the basic concepts and structure of the .Net Framework, and introduces Visual Studio .Net through the presentation of an application.
- About attitude:
Help students pay attention and receive the Visual Basic.NET programming language as a modern programming tool and widely applied in practice.
- About skills
After completing the lesson, students can install Visual Studio 2005 software and run programs 1.4.2; 1.4.3; 1.4.4.
THEORETICAL LECTURE CONTENT
1.1 Visual Studio.NET and .NET Framework
1.1.1 Introduction
In the age of information technology, data has become so important that people expect everything such as mobile phones, laptops, PDAs (Personal Digital Assistants) to be connected to each other to share data and the use of software to manage and use that data is "borderless". Applications must be available for use from computers as well as mobile phones 24/7, with few errors, fast processing and tight security.
These requirements create headaches for application developers when the software written primarily for one system does not run on another system due to many reasons such as differences in operating systems, differences in data communication standards, networks. Time and cost become more valuable because you are not the only one who knows how to program. How to reuse the applications written to expand further while still being compatible with new techniques?
Sun Microsystems is a leader in providing solutions with Java. Java runs reliably on Sun's Unix or Solaris operating systems from servers to handheld devices or even on Microsoft's Windows operating systems (a clear example is that most new generation mobile phones have software written in Java). The programming architecture is based on Java bytecode and executed on the Java Virtual Machine (JVM - Java Virtual Machine) allowing Java applications to run on any operating system. Java's pure object-oriented programming model allows programmers to freely reuse and extend available objects. Programming tool vendors rely on this to
integrates into its Java application development environments a variety of programming libraries to support programmers.
Java's power seemed so great that Microsoft had to fight back by removing Java Virtual Machine from its new versions of Windows operating systems such as Windows XP. However, Microsoft knew that even without providing a JVM, Sun could still provide JVM packages for Windows users. That's why the giant decided to start building a new application development platform from scratch: the Microsoft.NET Framework.
Simply put, .NET Framework is a library for .NET programmers. Framework is a collection or library of object classes that support programmers when building applications. .NET Framework's library includes more than 5000 object classes that are capable of supporting most of the programmer's requirements. Open source technology is included in .NET and in .NET, all components can be inherited and extended.
On February 13, 2002, Microsoft officially introduced its new programming toolkit – Visual Studio.NET based on Microsoft .NET technology. It is an application development environment using a graphical interface, integrating many different functions and utilities to provide maximum support for programmers.
.NET Framework is the most important component in .NET-based application development techniques. Visual Studio will help programmers grasp and better utilize the functions of .NET Framework.
1.1.2 .NET Framework Structure

Common language Specification:
The role of this component is to ensure interaction between objects regardless of the language they are built in, as long as they provide common components of the languages that want to interact.
ASP.NET
A library of object classes used in building Web applications. Web applications built with ASP.NET take advantage of the full capabilities of the .NET Framework. In addition, there is a new programming "style" that Microsoft gave a very catchy name: code behind. This is the way programmers building Windows-based applications often use - the interface and commands are separated.
Web services can be understood quite literally as services provided over the Web (or Internet). Services considered as Web services are not aimed at users but at software developers. Web services can be used to provide data or a computational function.
For example, your travel company is using a software system to record information about tourists registering for tours. To make hotel reservations at tourist destinations, the company needs to know information about available rooms at hotels. The hotel can provide a Web service to provide information about available rooms at a given time. Based on that, your software will know whether there is enough room to book for tourists? If there is enough, the software can use another Web service that provides room booking functionality to rent the hotel. The advantage of Web service here is that you do not need a person to contact the hotel to ask for room information, then, with enough information about many types of rooms, that person will determine which type of room to book, how many to book, enough or not enough, then contact the hotel again to book rooms. Do not forget that the hotel also needs someone to work with your staff and it is not certain that they can contact successfully.
Web services are provided based on ASP.NET and the operating system support of Internet Information Server.
Windows Form
The Windows forms library contains object classes for building Windows based applications.
ADO.NET and XML
This library includes classes for data processing. ADO.NET replaces ADO for common data manipulation. XML object classes are provided for you to process data in a new format: XML. Examples for this library are SqlDataAdapter, SqlCommand, DataSet, XMLReader, XMLWriter,…
Base Class Library
This is the most basic class library, used during programming or the .NET Framework builders themselves must also use it to build higher classes. For example, the classes in this library are String, Integer, Exception, ...
Common Language Runtime
It is the "connector" between the other parts of the .NET Framework and the operating system. The Common Language Runtime (CLR) manages the execution of applications written in .NET on Windows.
CLR will interpret program calls for Windows to execute, ensuring that the application does not occupy and overuse system resources. It also does not allow "dangerous" commands to be executed. These functions are performed by internal components of CLR such as Class loader, Just In Time compiler, Garbage collector, Exception handler, COM marshaller, Security engine, etc.
In newer versions of Windows operating systems like XP.NET and Windows 2003, the CLR is bundled with the operating system. This ensures that applications written on our computer will run on other computers without installation, the steps are simply a copy of DOS commands!
Operating System
The .NET Framework needs to be installed and used on an operating system. Currently,
.NET Framework is only capable of working on Microsoft Win32 and Win64 operating systems. In the near future, Microsoft will bring this system to Windows CE for handheld devices and can be extended to other operating systems such as Unix.
In its role of managing the construction and execution of applications, the .NET Framework provides object classes (Classes) so that NLT can call to execute the functions that those objects provide. However, whether this call is "responded" or not depends on the capabilities of the operating system running the application.
Simple functions like displaying a message box will be
The .NET Framework uses Windows API functions. More complex functionality such as using Components requires Windows to install Microsoft Transaction Server (MTS) or Web-based functions require Windows to install Internet Information Server (IIS).
Thus, choosing an operating system to install and use .NET Framework is equally important. Installing .NET Framework on Windows 2000, 2000 Server, XP, XP.NET, 2003 Server operating systems will be simpler and more convenient during programming.
1.1.3 Some features of Visual Studio .NET
The unique feature of Microsoft Visual Studio is that all programming languages in the .NET Framework share the same IDE (Integrated Development Environment), debugger, project and solution browser, class view, property window, toolbox, menus and toolbar.
In addition, some of the following characteristics must also be mentioned:
1. Keywords and command syntax are highlighted.
2. Automatically complete command syntax when the programmer marks dots with objects, namespaces, enums, and when using the New keyword.
3. Project and solution browser allows managing applications containing multiple files with different formats.
4. Allows users to build interfaces with just drag and drop
form
5. The properties window allows setting values for different properties
of controls on a form or on a web page.
6. The debugger allows debugging of the program by setting break points while monitoring the program's execution.
7. Hot compiler allows checking the syntax of the code line and notifying detected errors as soon as the user enters the command line from the keyboard.
8. Users are assisted by Dynamic Help using MSDN (Microsoft Development Network library).
9. Compiled and building applications.
10. Allows execution of the application with/without a debugger.
11. Deploy your .NET application to the Internet or CD.
Projects and Solutions
A Project is a combination of executable program files and library files to create an application or a module. Project information is usually stored in files with the extension .vbproj (VB.NET) or csproj (C#). Some types of projects in Visual Studio .NET include Console, Windows Application, ASP.NET, Class Libraries,...
In contrast, a solution is often a combination of different projects to form a number of applications. For example, a solution can include an ASP.NET WEB Application project and a Windows Form project. The information of a solution is stored in .sln files and is managed using the Visual Studio .NET Solution Explorer.
Toolbox, Properties and Class View Tabs
All programming languages in the Visual Studio .NET suite share a common toolbox. This toolbox (usually located on the left side of the screen) contains a number of common controls for Windows, Web, and data applications, such as text boxes, checkboxes, tree views, list boxes, menus, and file open dialogs.
Properties Tab - the properties window (usually appears on the right) allows setting properties for forms and controls at design time without writing code.
1.2 Install Visual Studio 2005 software
Microsoft Visual Studio 2005 is a suite of products that provide 3 programming languages Visual Basic.NET (VB.NET), C# (C Sharp), Visual C++.NET and Visual J#.NET. In addition, the Integrated Development Environment ( IDE ) helps programming easily and comfortably. The IDE not only provides all the necessary programming tools but also helps to check the source code or create a visual Windows interface, search for files related to the project and much more.
1.2.1 Hardware requirements

1.2.2 Installation:
Microsoft Visual Studio 2005 usually includes 4 CDs. Before installing, you must run the files on the 3 CDs to extract them into a folder on your hard drive. After extracting, there will be two main folders: the VS folder (containing the Visual Studio .Net 1.17GB installation files) and the MSDN folder (containing the libraries that support the use of Visual Studio.NET 1.55GB).
To install, run the Setup.exe file in the VS folder then select the Install Visual Studio 2005 function.





