Database Applications
Database Applications
Applications
Pemrograman Visual (TH22012 )
by Kartika Firdausy
[email protected]
blog.uad.ac.id/kartikaf
kartikaf.wordpress.com
Introduction
A database is a list or a group of lists of objects
organized to make the list(s) and its (their)
values easy to create and manage.
In the computer world, this suggests, rightly,
that the list(s) and its(their) values are stored
in a machine.
As information becomes of high importance,
almost every company keeps some type of
database, whether it includes its employees,
its customers, or the products it sells.
Introduction
To make it possible to create computer databases,
throughout its history, Microsoft developed various
libraries and programming environments.
Microsoft ActiveX Data Objects or ADO, is a
library used to manage databases.
Microsoft ActiveX Data Object Extensions for
Data Definition Language and Security
abbreviated ADOX, is an addition to ADO.
It can be used to create and manage a database,
providing some of the same operations as ADO but
also some operations not possible in ADO.
Database Creation
To get a database, you can either use one that exists already or you
can create your own. ADO by itself doesn't provide the means to
create a database.
To create one, you can use the Microsoft ActiveX Data Objects
Extensions for Data Definition Language and Security, abbreviated
ADOX. Before using ADOX, you must reference it in your Microsoft
Visual C++ project.
Database Creation
To do this, on the main menu of Visual C++
Express, you can click
Database Creation
In the Property Pages, click Add New References
Database Creation
In the COM tab of the Add Reference dialog box, locate the
Microsoft ADO Ext. 2.7 or 2.8 for DDL and Security:
Click OK.
ADO Fundamentals
The .NET Framework is a library, developed by
Microsoft, that can be used to create different types of
applications, including databases.
The .NET Framework comes with a technique of
creating and managing databases known ADO.NET.
Although ADO is a true library, ADO.NET is not a library:
it is only a technique of dealing with databases.
The ADO part suggests that it uses concepts similar to
the ADO approach of solving database operations.
The .NET part of the name means that it uses the .NET
Framework.
In the .NET Framework, ADO is represented by the
ADODB namespace. The classes used to create and
manage tables are stored in the ADODB namespace.
A Data Source
You may plan to create a database that would be used by one
person using one computer.
As your job becomes more effective, you could be asked to
create another database that would be accessed by different
people.
Regardless of why and how, after creating a database, you
should have a way of making it available to those who would
use it.
To do this, you can create a data source.
A Data Source
A database is created as a computer file and it has a path,
that is, where the database file is located.
The path to a file is also known as its location.
The path to a database, including its name, is also called the
data source.
In some of your database operations, you will be asked to
provide a data source for your database.
In this case, provide the complete path followed by the name
of the database.
A Data Source
If you plan to access your database from another
programming environment, then you should create an ODBC
data source.
In the Control Panel or the Administrative Tools,
double-click Data Source (ODBC) to open the ODBC Data
Source Administrator
To proceed, click the Add button.
A Data Source
In the Create New Data Source wizard,
click Microsoft Access Driver (*.mdb)
click Finish
A Data Source
Enter a name for the data source.
In the Description text box, you can enter a
short sentence anyway you like.
To specify the database that would be used,
click Select and select an mdb database.
Here is an example:
A Data Source
Here is an example:
A Data Source
To specify the database that would be created,
click Create.
Here is an example:
A Data Source
Here is an example:
A Data Source
Here is an example:
A Data Source
if you need to be authenticated in order to use
the database (if the database is protected),
click the Advanced button.
A Data Source
By default, a database is meant to allow
anybody to use it.
In this case, you can leave the Login Name
and the Password empty.
Otherwise, type the necessary credentials:
Data Records
A table was made of one or various columns that
represent categories of data.
After creating such a table and its columns that
represent the categories, you (actually the user) can
enter values in the table to make it a valuable list.
Filling up a table with values is referred to as data
entry.
Data entry is performed by entering a value under the
column headers.
The group of values that correspond to the same entry
or the same line under the columns is called a record.
This also means that the records are entered one line,
also called a row, at a time
A record on a table is represented as a row (horizontal)
of data.
Data Records
Start Microsoft Visual Studio .NET and create a
new Windows Forms Application
in the Toolbox click DataSet
Data Records
In the Add Dataset dialog box,
click the Untyped Dataset radio button
click OK
Data Records
While the DataSet control is still selected,
in the Properties window, click (Name) and
type dsMahasiswa
set the DataSetName to Mahasiswa
Data Records
While the DataSet control is still selected,
in the Properties window, click Tables and click
button
Tables Collection Editor click Add button
Data Records
Tables Collection Editor
in the Properties window, click (Name) and
type tblPersons
set the TableName to Persons
Data Records
in the Persons Properties window, click
Columns and click button
Tables Collection Editor click Add button
Data Records
Columns Collection Editor click Add
button,
in the Properties window, click (Name) and
type colNama
set the ColumnName to Nama
Data Records
Toolbox ListView,
in the Properties window, click (Name) and
type lvwPeople
set the AllowColumnReorder to True
Data Records
Toolbox Button
in the Properties window, click (Name) and
type btnClose
set the Anchor to Bottom, Right
Data Records
While the ListView lvwPeople is still
selected,
in the Properties window, click View and type
Details
Data Records
ColumnHeader Collection Editor
Properties window
click (Name) and type Alamat
set the Text to Alamat
Width 120
Data Records
Double-click the Tutup button and implement its
Click event as follows:
private: System::Void btnClose_Click(System::Object *
sender, System::EventArgs * e)
{
Close();
}
References
http://www.functionx.com/vcnet/index.htm
http://www.functionx.com/vcnet/databases/d
atarow.htm