After opening VS 2005, create a new project and let's begin
with a Visual Basic Windows project. In the dialog at the
base, name your project north wind Win and the Solution North
wind.
The Data Object
The 1st step in making a data application is to generate a
Typed DataSet object to define the data entity to be used. You
may add a new DataSet object to you project as of the Solution
Explorer window by right-clicking on top of the project and
choosing Add / New Item. The design surface of the DataSet has
been improved to routinely include relations since the
database while more than one table is added to the dataset.
The DataSet has been extended to contain one or additional
data adapters to grip the "Fill" and "Update" methods so we
don't want to create an inherited class to apply them. The
design Wizard has been changed a little, but accomplished the
same effect.
A superior way to make a
DataSet is to utilize the Data Sources wizard. With the proper
project chosen, click the top line Data menu and pick "Add New
Data Source". The Data Source Design Wizard will take over and
rung you through creating a DataSet with the suitable
connection. Just click next on the 1st screen. The next screen
allows you to prefer the type of Data Source.
This time we will select the
Database type, but get note of the additional options to
utilize a Web Service or obtainable Business Object, because
we will come backside to them.
The 2nd screen allows you to select an accessible connection
or make a new one.
If you do not have a relation
to the North wind database, use the New link button to create
one now. If you have not previously set up a Project Setting
for this link, the Wizard will perform it for you at the
present.
In the Next screen of the
Wizard, you will be exposed a tree listing of all the Meta
data in the database. Expand the Tables lump and choose the
tables wanted in this DataSet.
Earlier than departure this screen, be certain to correctly
name your DataSet. In this case, we require changing the name
of the dataset since North wind DataSet to Orders DataSet.
After finalize the Wizard, you
will have a dataset added to your project with three tables in
it.
With this design facade, you can carry on to draw more tables
from the Server Explorer (Database Explorer in Standard
version) to put in to the dataset. Looking in front, we know
we will require adding the Customers and Employees tables for
combo box lookups.
You can change in the same
tables by right-clicking on the header and selecting Configure
from the drop down menu.
Click the Query Builder switch
to visually edit the SQL for the Table Adapter. In this
situation, the combo box will want a Full Name field that
combines the ‘last’ and ‘first’ names.
You can as well click the Advanced Options button to deselect
the choice to generate modernize and remove methods while this
table is for search for only and will not be edited. Click the
‘Next’ button for more options on the Fill, GetData and Update
methods and finish the Wizard. Show again this configuration
for the Customers table.
|