Connection String

The connection string defines which database server you are using, where It resides, your user name and password and optionally the database name.

//for SQL server

string  constr=”server=.; database=dbemployee; uid=sa; pwd=;” ;

//for SQL Express

string  constr=”server=.sqlexpress; database=dbemployee; uid=sa; pwd=;” ;

.sqlexpress – server name on the computer

Dbemployee – name of database with which we are dealing

sa – System administrator, user responsible for login in database.

Pwd – password which is blank if not given to the database otherwise we have to mentioned if given at the time of database creation.

SqlConnection cn = new SqlConnection(@”Data Source=.SQLEXPRESS;AttachDbFilename=”+ Application .StartupPath +“\dbdemo.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True”);

Read More

Specific Classes of ADO.Net

ADO.Net also contains some database specific classes. This means that different database system providers may provides classes or drivers optimized for their particular database system. Microsoft has also provided the general classes which can connect your application to any OLE supported database server. The name of these classes starts with OleDb and these are contained in the System.Data.OleDb namespace. In fact we can you use OleDb classes to connect to SQL server or Oracle database, using the database specific classes generally provides optimized performance.

ClassDescription
SqlConnection, OleDbConnectionRepresents a connection to the database system.
SqlCommand, OleDbCommandRepresents SQL query
SqlDataAdapter, OleDbDataAdapterA class that connects to the database system fetches the records and fills the dataset.

SqlDataReader, OleDbDataReaderA stream that reads data from the database in a connected design.

SqlParameter, OleDbParameterRepresents a parameter to a stored procedure.
Read More

Components of ADO.Net

All generic classes for data access are contained in the System.Data namespace.

 ClassDescription
DataSetThe DataSet is a local buffer of tables or a collection of disconnected       records sets.
DataTable

 A DataTable is used to contain data in tabular form using rows and   columns

DataRow Represents a single record or row in a DataTable.

DataColumn

 Represents a column or field of  a DataTable

DataRelation

 Represents the relationship between different tables in a data set.

Constraint Represents the constraints or limitations that apply to a particular field or column.
Read More

Data set

The application stays connected to the DB system even when it is not using DB services. This commonly wastes valuable and expensive database resources, as most of the time applications only query and view the persistent data. ADO.Net solves this problem by managing a local buffer of persistent data called data set. 
Our application automatically connects to the database server when it needs to run a query and then disconnects immediately after getting the result back and storing it in the dataset. This design of ADO.Net is called disconnected data architecture and is very much similar to the connectionless services of HTTP on the internet. ADO.Net also provides connection oriented traditional data access services.
An important aspect of disconnected architecture is that it maintains a local repository of data in the dataset object. The dataset object stores the tables, their relationship and their different constraints. The user can perform operations like update, insert and delete on this dataset locally, and the changes made to the dataset are applied to the actual database as a batch when needed. This greatly reduces network traffic and results in better performance.
 

Read More

Data set

The application stays connected to the DB system even when it is not using DB services. This commonly wastes valuable and expensive database resources, as most of the time applications only query and view the persistent data. ADO.Net solves this problem by managing a local buffer of persistent data called data set. 
Our application automatically connects to the database server when it needs to run a query and then disconnects immediately after getting the result back and storing it in the dataset. This design of ADO.Net is called disconnected data architecture and is very much similar to the connectionless services of HTTP on the internet. ADO.Net also provides connection oriented traditional data access services.
An important aspect of disconnected architecture is that it maintains a local repository of data in the dataset object. The dataset object stores the tables, their relationship and their different constraints. The user can perform operations like update, insert and delete on this dataset locally, and the changes made to the dataset are applied to the actual database as a batch when needed. This greatly reduces network traffic and results in better performance.

Read More

Introduction to ADO .net

(Active Database Object)

ADO.NET is a set of classes that we can use with .NET framework and its supportable language to access data in a relational, table-oriented format. ADO.NET is an object oriented framework that allows you to interact with database systems.

Read More