Posts

Showing posts from March, 2013

ASP.Net Page Life Cycle

Understanding the Pagelife cycle is important to develop ASP.Net application. The general Page Life Cycle Stages are: 1. Page request - Here Page is requested by the user. 2. Start – Sets the properties such as Request, Response, IsPostBack and UICulture. 3. Page initialization - Controls on the page are available and each control's UniqueID property is set. 4. Load – Controls are loaded here if it is a PostBack request. 5. Validation – Sets the IsValid property. 6. Postback Event handling – Event handlers will be called if it is PostBack. 6. Rendering - the page calls the Render method for each control, providing a text writer that writes its output to the OutputStream of the page's Response property. 7. Unload - Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded. Common life cycle Events: 1. PreInit – Start event of the Page life cycle and here every page controls are initialized. 2. Init – This is used to read or initia...

Difference between ASP.NET and ASP

ASP - Code Render Block - Request/Response - Session - weren't transferable across servers - Built on top of the Windows and IIS, it was always a separate entity and its functionality was limited. ASP.NET - Code Declaration Block - Compiled - Event Driven - Object Oriented - Constructors/Destructors, Inheritance, Overloading. - Exception Handling - Try, Catch, Finally - Down-level Support - Cultures - User Controls - In-built client side validation - It can span across servers, it can survive server crashes, can work with browsers that don't support cookies. - Its an integral part of OS under the .NET framework. It shares many of the same objects that traditional applications would use, and all .NET objects are available for ASP.NET's consumption. - Garbage Collection - Declare variable with datatype - In built graphics support - Cultures

What is Abstraction?

Ans 1:- Abstraction is a process by which concepts are derived from the usage and classification of literal ("real" or "concrete") concepts, first principles, or other methods. "An abstraction" is the product of this process – a concept that acts as a super-categorical noun for all subordinate concepts, and connects any related concepts as a group, field, or category. Abstractions may be formed by reducing the information content of a concept or an observable phenomenon, typically to retain only information which is relevant for a particular purpose. For example, abstracting a leather soccer ball to the more general idea of a ball retains only the information on general ball attributes and behavior, eliminating the other characteristics of that particular ball. ============================== ======================= Ans 2:- Abstraction (from the Latin abs, meaning away from and trahere, meaning to draw) is the process of taking away or removing characterist...

What is Data Hiding?

Data hiding is a characteristic of object-oriented programming. Because an object can only be associated with data in predefined classes or templates, the object can only "know" about the data it needs to know about. There is no possibility that someone maintaining the code may inadvertently point to or otherwise access the wrong data unintentionally. Thus, all data not required by an object can be said to be "hidden."

What is encapsulation?

In general, encapsulation is the inclusion of one thing within another thing so that the included thing is not apparent. Decapsulation is the removal or the making apparent a thing previously encapsulated. 1) In object-oriented programming, encapsulation is the inclusion within a program object of all the resources need for the object to function - basically, the methods and the data. The object is said to "publish its interfaces." Other objects adhere to these interfaces to use the object without having to be concerned with how the object accomplishes it. The idea is "don't tell me how you do it; just do it." An object can be thought of as a self-contained atom. The object interface consists of public methods and instantiated data.

Difference between Dataset and Datareader?

-->Data Set is a connectionless service and Data reader is a connection oriented -->service. Dataset is used to store the data, it contains collections of Datatable. -->Datareader is used to connect to the database for retrieving data. -->Data Reader - Forward only where as Dataset - Can loop through dataset. -->Data Reader - Connected Recordset where as DataSet - Disconnected Recordset -->Data Reader - Less Memory Occupying where as DataSet - It occupies more memory -->Data Reader - Only Single Table can be used where as Dataset - Datatable -->Concept allows data to be stored in multiple tables. -->Data Reader - Read only where as DataSet - Can add/update/delete using the dataset -->Data Reader - No relationship can be maintained where as DataSet - Relationship can be maintained. -->Data Reader - No Xml Storage available where as DataSet - Can be stored as XML. -->The Dataset is a core of disconnected architecture. Disconnected architecture means on...

what is sqldataadapter..

SqlDataAdapter is a part of the ADO.NET Data Provider and it resides in the System.Data.SqlClient namespace. SqlDataAdapter provides the communication between the Dataset and the SQL database. We can use SqlDataAdapter Object in combination with Dataset Object. Dim adapter As New SqlDataAdapter The SqlDataAdapter Object and DataSet objects are combine to perform both data access and data manipulation operations in the SQL Server Database. When the user perform the SQL operations like Select , Insert etc. in the data containing in the Dataset Object , it won't directly affect the Database, until the user invoke the Update method in the SqlDataAdapter. Source Code:- ============ Imports System.Data.SqlClient Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim connetionString As String Dim sqlCnn As SqlConnection Dim sqlCmd As SqlCommand Dim adapter As New SqlDataAdapter Dim ds As New DataSet Dim i As Int...

sqldataadapter vs sqldatareader

SqlDataReader: Holds the connection open until you are finished (don't forget to close it!). Can typically only be iterated over once Is not as useful for updating back to the database On the other hand, it: Only has one record in memory at a time rather than an entire result set (this can be huge) Is about as fast as it you can get for that one iteration Allows you start processing results sooner SqlDataAdapter/DataSet Lets you close the connection as soon it's done loading data, and may even close it for you automatically All of the results are available in memory You can iterate over it as many times as you need, or even look up a specific record by index Has some built-in faculties for updating back to the database At the cost of: Much higher memory use You wait until all the data is loaded before using any of it So really it depends on what you're doing, but I tend to prefer a DataReader until I need something that's only supported by a dataset. SqlDataReader is pe...

What is DLL..

A DLL is a library that contains code and data that can be used by more than one program at the same time. For example, in Windows operating systems, the Comdlg32 DLL performs common dialog box related functions. Therefore, each program can use the functionality that is contained in this DLL to implement an Open dialog box. This helps promote code reuse and efficient memory usage. By using a DLL, a program can be modularized into separate components. For example, an accounting program may be sold by module. Each module can be loaded into the main program at run time if that module is installed. Because the modules are separate, the load time of the program is faster, and a module is only loaded when that functionality is requested. Additionally, updates are easier to apply to each module without affecting other parts of the program. For example, you may have a payroll program, and the tax rates change each year. When these changes are isolated to a DLL, you can apply an update without ...

What is garbage collection

The .Net Framework provides a new mechanism for releasing unreferenced objects from the memory (that is we no longer needed that objects in the program) ,this process is called Garbage Collection (GC). When a program creates an Object, the Object takes up the memory. Later when the program has no more references to that Object, the Object's memory becomes unreachable, but it is not immediately freed. The Garbage Collection checks to see if there are any Objects in the heap that are no longer being used by the application. If such Objects exist, then the memory used by these Objects can be reclaimed. So these unreferenced Objects should be removed from memory , then the other new Objects you create can find a place in the Heap. The reclaimed Objects have to be Finalized later. Finalization allows a resource to clean up after itself when it is being collected. This releasing of unreferenced Objects is happening automatically in .Net languages by the Garbage Collector (GC). The progra...