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…
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 @ http://www.oracle.com/technetwork/topics/dotnet/downloads/net-downloads-160392.html 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:
Upon 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…
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…
Assalamualaykum Wr Br…Today we make tour of the ASP.NET FileUpload Control. Asp.Net FileUpload Control allows users to upload files on the web server. It automatically sets the encoding of the form. It allows the users to browser for and select the file to be uploaded, providing the Browse Button and TextBox for entering the File Name. Once the User has entered the File Name in the TextBox by typing the Name or Browsing, the SaveAs method of the FileUpload Control can be called to save the file to the disk.
The basic syntax of the FileUpload Control is:
The FileUpload Class is derived from WebControl Class, and inherits all its members. There are some read only properties which can be stated as:
The posted File is encapsulated in an object of type HttpPostFile, which could be accessed through the PostedFile Property of the FileUpload Class.
The HttpPostedFile has Following properties:
Now, Let us start the Practice Session…Design the ASP.NET page as shown below:
The Above Design view can be coded as shown below:
The Code Behind for the button SAVE is shown as:
When this Program is executed we get the following output:
Hope enjoyed this tour…Jazakallah khair
Assalamualaykum Wr Br…
Today we walk through the code for compressing files in C#.Net 4.5 Framework using Zip.
There are many formats that are available in C#.Net like Deflate, GZip, Zip and many more…We focus mainly on Zip format now in later posts we try to follow other formats inshallah..
Before we start our coding, First add the reference of WindowsBase.dll” in your solution. In case if you couldn’t find it in .Net tab of references window then go to Browse tab and try to find it in the directory as shown:
“C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\”
One more thing we need to do is Import a System.IO.Packaging in your using block.
The following image shows the code:
The output of the above program is shown as:
hope it is helpful to anyone…