Sample Application Demonstrating LINQ

Assalamualaykum Wr Br…Today we build simple Web Application which demonstrates insertion of data from UI to data table without using Connection, Command class but using LINQ(Language Integrated Query).

Lets quick start our building by designing the Form as shown belowLinq_desing_form

Associated HTML code is shown as:


Now Drag & Drop the dbml file which creates the DataContext Class with various methods and properties. It also creates class as similar to our table which is shown below:

Now the Button_Click event code is shown below:
The above code generates the following output as shown below:

Thats all for the Day!!!…Happy Coding…Jazakallah Khair
Which generates the following output as shown below:


Assalamualaykum Wr Br…Today we understand few thing about ADO.NET architectures then we explore the theory and practical tour. ADO.NET Disconnected architecture is a method of retrieving a record set from the database and storing it giving you the ability to do many CRUD (Create, Read, Update, Delete) operations on the data in memory, then it can be re-synchronized with the database when reconnecting. A method of using disconnected artitecture is using a DataSet.

Connected architecture is when you constaintly make trips to the database for any CRUD operation you wish to do. this creates more traffic to the database but is normally much faster as you should be doing smaller transactions.
Now we start our tour of practice with the following design view as shown:
When you click the Button then in new line Gridview is populated with data in which Disconnected ADO.NET class named SqlDataAdapter is used which executes the command, fills data in DataSet and this DataSet is assigned to GridView as Data Source and finally Binded to Grid. Button_Click Code is demonstrated as below:

Finally the Output of the above code is shown below:
Thats all of the day…Hope Enjoyed the post…
Jazakallah Khair…

Bind Data to Grid in ADO.NET

Assalamualaykum Wr Br… Today we explore how data can be populated on GridView…
Let us first we understand what is GridView?
To be very specific, GridView is a Control which is highly used to display data in tabular format. In detail,
The GridView control is the successor to the DataGrid and extends it in a number of ways. With this GridView control, you could display an entire collection of data, easily add sorting and paging, and perform inline editing. In addition to just displaying data, the GridView can be used to edit and delete the displayed data as well. Now lets start our practical session, where I import SqlClient,OracleClient or OledbClient dlls in my project and in addition to hard coding C# standard as using System.Data.SqlClient; or VB Standard as imports System.Data.SqlClient
When you want to connect to Oracle Database, you need to download Oracle.DataAccess dll which is available @ which available in ODAC package. Please follow the Design Pattern as shown:

The respective C#.NET code for Button click which populates data in GridView is shown:
grid_codeUpon Executing the above project the following output appears after button click:
Please note that I used DataReader which is Disconnected data architecture which we deal it in coming posts…Hope you might enjoy this post…Till Then have a good day…

Jazakallah khair…

Working With ADO.NET – 1

Assalamualaykum Wr Br…Today we start our journey towards ADO.NET. ADO refers to ActiveX Data Object
ADO.NET provides a bridge between the front end controls and the back end database. The ADO.NET objects encapsulate all the data access operations and the controls interact with these objects to display data, thus hiding the details of movement of data.

The following figure shows the ADO.NET objects at a glance:

We start a sample application that demonstrates the connection establishment to Database from Front-End.
Design the UI as follows:
The following code demonstrates the logic:
The output can be shown as:
Hope you Enjoyed the journey first phase..There’s a lot more…till then Enjoy coding…