Assignment For Course-Gad 22034
Assignment For Course-Gad 22034
Users of applications built with the .NET Framework need to have .NET Framework installed. In
most cases, .NET Framework is already installed with Windows. If needed, you can download .NET
Framework.
Software developers use .NET Framework to build many different types of applications—websites,
services, desktop apps, and more with Visual Studio. Visual Studio is an integrated development
environment (IDE) that provides development productivity tools and debugging capabilities. See
the .NET customer showcase for examples of what people are building with .NET.
2. Shared Assemblies: Microsoft offers the shared assembly for those components that must
be distributed. It centered around two principles.
Firstly, called side-by-side execution, allows the CLR to house multiple
versions of the same component on a single machine.
Secondly, termed binding, ensures that clients obtain the version of the
component they expect.
3. Satellite Assembly: A satellite Assembly is defined as an assembly with resources only, no
executable code.
To build an assembly in Visual Studio, on the Build menu, select Build.
Q.3.What is an Interface?
Answer:
Interface is a type which contains only the signatures of methods, delegates or events, it has no
implementation. Implementation of the methods is done by the class which implements
the interface. Interface is a contract that defines the signature of the functionality.
An interface contains definitions for a group of related functionalities that a non-abstract class or a
struct must implement. By using interfaces, you can, for example, include behavior from multiple
sources in a class.
Q.4. What is CLR?
Answer:
The Common Language Runtime (CLR), the virtual machine component of Microsoft .NET framework,
manages the execution of .NET programs. Just-in-time compilation converts the managed
code (compiled intermediate language code), into machine instructions which are then executed on
the CPU of the computer.[1] The CLR provides additional services including memory management, type
safety, exception handling, garbage collection, security and thread management. All programs written
for the .NET framework, regardless of programming language, are executed by the CLR. All versions of
the .NET framework include CLR. The CLR team was started June 13, 1998.
Advantages of VB.NET
The following are the pros/benefits you will enjoy for coding in VB.NET:
Q.8.What is ADO.NET?
Answer:
ADO.NET is a data access technology from the Microsoft .NET Framework that provides
communication between relational and non-relational systems through a common set of components.
[1]
ADO.NET is a set of computer software components that programmers can use to access data and
data services from a database. It is a part of the base class library that is included with the Microsoft
.NET Framework. It is commonly used by programmers to access and modify data stored in relational
database systems, though it can also access data in non-relational data sources. ADO.NET is sometimes
considered an evolution of ActiveX Data Objects (ADO) technology, but was changed so extensively
that it can be considered an entirely new product.
The following figure shows the ADO.NET objects at a glance:
Q.9. Give an example of a .NET application which connects to Microsoft Access Database using
Ado.net classes.
Answer:
Important classes of ADO.NET
Connection
Command
Datareader
DataAdapter
Dataset
The .Net Framework provides three important Data Providers for ADO.NET. They are the Microsoft SQL
Server Data Provider, OLEDB Data Provider and ODBC Data Provider. Connection, Command,
DataReader, and DataAdapter objects are data provider.
If you are using MS SQL server as a database, then use System.Data.SqlClient.
If you are using Oracle server as a database, then use System.Data. OracleClient.
When you want to connect to a database, you will use the Connection object. In this part you will learn
to connect to databases of Ms. Access and SQL Server. To connect to Ms. Access databases, we use
System.Data.Oledb class. And to connect to SQL Server databases, we use System.Data.SqlClient class.
Example: Connect to MS Access database
Dim cn As OleDb.OleDbConnection
'Create Connection object
cn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0; Data Source=" &
Application.StartupPath & "\dbimages.mdb")
'Create Connection object
cn.Open()
OR
'Create Connection object
Dim cn As New OleDb.OleDbConnection
'Set connection string
cn.ConnectionString="Provider=Microsoft.Jet.Oledb.4.0; Data Source=" & Application.StartupPath
& "\dbimages.mdb"
cn.Open()
This code will connect to Ms. Access database “dbimages.mdb” located in start up path of the current
project. The database contains a table named tblimages that store image ID and its path.
If the database has password protection (e.g. 123), the connection string should be modified to:
For newer Ms. Access database (2007+), you need to use another provider called
Microsoft.ACE.OLEDB.12.0 rather than Microsoft.Jet.Oledb.4.0.
Q.10.What is a Dataset?
Answer:
DataSet is an in-memory representation of data. It is a disconnected, cached set of records that are
retrieved from a database. When a connection is established with the database, the data adapter
creates a dataset and stores data in it. After the data is retrieved and stored in a dataset, the
connection with the database is closed. This is called the 'disconnected architecture'. The dataset
works as a virtual database containing tables, rows, and columns.
Properties Description
CaseSensitive Indicates whether string comparisons within the data tables are case-sensitive.
EnforceConstraints Indicates whether constraint rules are followed when attempting any update operation.
Events Gets the list of event handlers that are attached to this component.
ExtendedProperties Gets the collection of customized user information associated with the DataSet.
Locale Gets or sets the locale information used to compare strings within the table.
Prefix Gets or sets an XML prefix that aliases the namespace of the DataSet.
Q.11.What is DataAdapter?
Answer:
This is integral to the working of ADO.Net since data is transferred to and from a database through
a data adapter. It retrieves data from a database into a dataset and updates the database. When
changes are made to the dataset, the changes in the database are actually done by the data
adapter.
The DataAdapter can perform Select , Insert , Update and Delete SQL operations in the Data Source.
The Insert , Update and Delete SQL operations , we are using the continuation of the Select command
perform by the DataAdapter. That is the DataAdapter uses the Select statements to fill a DataSet and
use the other three SQL commands (Insert, Update, delete) to transmit changes back to the Database.
From the following links describe how to use SqlDataAdapter and OleDbDataAdapter in detail.
SqlDataAdapter
OleDbDataAdapter
DataReader = Command.ExecuteReader()
DataReader Object provides a connection oriented data access to the data Sources. A Connection
Object can contain only one DataReader at a time and the connection in the DataReader remains open
and cannot be used for any other purpose while data is being accessed. When started to read from a
DataReader it should always be open and positioned prior to the first record. The Read() method in the
DataReader is used to read the rows from DataReader and it always moves forward to a new valid row,
if any row exist .
DataReader.Raed()
There are two types of DataReader in ADO.NET. They are SqlDataReader and the OleDbDataReader.
The System.Data.SqlClient and System.Data.OleDb are containing these DataReaders respectively.
From the following link you can see in details about these classes.
SqlDataReader
OleDbDataReader
The .NET Framework provides the following data providers that we can use in our application.
.NET Framework Data It provides data access for Microsoft SQL Server. It requires
Provider for SQL Server the System.Data.SqlClient namespace.
.NET Framework Data It is used to connect to data sources by using ODBC. It requires
Provider for ODBC the System.Data.Odbc namespace.
EntityClient Provider It provides data access for Entity Data Model applications. It requires
the System.Data.EntityClient namespace.
.NET Framework Data It provides data access for Microsoft SQL Server Compact 4.0. It requires
Provider for SQL Server the System.Data.SqlServerCe namespace.
Compact 4.0.
Object Description
DataReader It is used to read data from data source. The DbDataReader is a base class for all DataReader
objects.
DataAdapter It populates a DataSet and resolves updates with the data source. The base class for all
DataAdapter objects is the DbDataAdapter class.
Q.14. What is the difference between Connected and Disconnected environment?
Answer:
Connected environment Disconnected environment
The architecture of ADO.net, in which connection The architecture of ADO.net in which data retrieved
must be opened to access the data retrieved from from database can be accessed even when
database is called as connected architecture. connection to database was closed is called as
disconnected architecture.
It is connection oriented. It is dis_connection oriented.
Connected methods gives faster performance Disconnected get low in speed and performance.
connected can hold the data of single table disconnected can hold multiple tables of data
connected you need to use a read only forward disconnected you cannot
only data reader
Data Reader can't persist the data Data Set can persist the data
DataTable represents relational data into tabular form. ADO.NET provides a DataTable class to create
and use data table independently. It can also be used with DataSet also. Initially, when we create
DataTable, it does not have table schema. We can create table schema by adding columns and
constraints to the table. After defining table schema, we can add rows to the table.
DataTable Properties
Property Description
Columns It is used to get the collection of columns that belong to this table.
DefaultView It is used to get a customized view of the table that may include a filtered view.
HasErrors It is used to get a value indicating whether there are errors in any of the rows in the table
of the DataSet.
MinimumCapacit It is used to get or set the initial starting size for this table.
y
PrimaryKey It is used to get or set an array of columns that function as primary keys for the data table.
Rows It is used to get the collection of rows that belong to this table.
Date Of Submission:
Signature: