DataReader vs DataSet vs DataAdapter
Difference between DataReader,DataSet and DataAdapter
S.No DataReader DataSet / DataAdapter 1 Database Connecting Mode:Connected modeDatabase Connecting Mode:Disconnected mode2 Data Navigation:Unidirectional i.e., Forward OnlyData Navigation:Bidirectional i.e., data can navigate back and forth3 Read / Write:Only Read operation can be carried out.Read / Write:Both Read and Write operations are possible4 Data Handling:Handles Database tableData Handling:Handles text file, XML file and Database table5 Storage Capacity :No storageStorage Capacity :Temporary Storage Capacity i.e., in-memory cache of data6 Accessibility :Can access one table at a timeAccessibility :Can access multiple table at a time7 Speed:Much faster than DataSetSpeed:Less faster than data readerDatabase vs Schema
Difference between Database and Schema
S.No Database Schema 1 Database is a collection of organized dataDatabase schema describes the structure and organization of data in a database system2 The database holds the records, fields and cells of data Schema contains Databases and describes how these database fields and cells are structured and organized and what types of relationships are mapped between these entities DataTable vs DataSet
Difference between DataTable and DataSet
S.No DataTable DataSet 1 Meaning:A DataTable is an in-memory representation of a single database table which has collection of rows and columns.Meaning:A DataSet is an in-memory representation of a database-like structure which hascollection of DataTables.2 Number of rows retrieved at a time:DataTable fetches only one TableRow at a timeNumber of rows retrieved at a time:DataSet can fetch multiple TableRows at a time3 Provision of DataRelation Objects:As DataTable is a single database table, so there is no DataRelation object in it.Provision of DataRelation Objects:In DataSet, DataTable objects can be related to each other with DataRelation objects.4 Enforcing Data Integrity:In DataTable, there is no UniqueConstraint and ForeignKeyConstraint objects available.Enforcing Data Integrity:In DataSet, data integrity is enforced byusing the UniqueConstraint and ForeignKeyConstraint objects.5 DataSource can be Serialized or Not:In DataTable, DataSource cannot be serialized.DataSource can be Serialized or Not:DataSet is serialized DataSource .That is why web services can always returns DataSet as the result but not the DataTables.
Example for DataTable:sqldataadapter da = new SqlDataAdater("select * from Employee", con);DataTable dt = new DataTable();da.Fill(dt);datagridview1.DataSource = dt;Example for DataTable:sqldataadapter da= new SqlDataAdater("select * from Employee", con);DataSet ds = new DataSet();da.Fill(ds);datagridview1.DataSource = ds.table[0];Difference between div and table
Difference between div and table
S.No Div Table 1 Purpose:To display block of HTML and dataPurpose:To display Text and in fewer cases images as well.2 Layout / Type:DIV is floating type and can divide our webpage into multiple divisions..So,Divs are more flexible--as they do not strict to tabular layouts.Layout / Type:Table is Fixed type and consists of table rows(tr), table data(td),table header(th)..So,tables are strict for those layouts which are more tabular.3 Search Engine Friendly:Div is better for SEOSearch Engine Friendly:Table is not Search engine friendly4 Loading Time:The loading time of DIV based website is faster than Table based website.Loading Time:The loading time of table based website is not faster than DIV based website.5 Website Alignment:In DIV,we can control the website alignment by CSS which is comparatively easier than tableWebsite Alignment:Table does not make use of CSS, hence website alignment is comparatively difficult6 Website Changes:In Div, designers can make a single change to the CSS and it will modify the entire website.Website Changes:In table, designers cannot make a single change as like DIV7 Does CSS Knowledge required ?For Div based layout, we should have knowledge about CSS. Otherwise, we cannot control the Div based website errors.Does CSS Knowledge required ?Table based website does not require CSS Knowledge in oder to control the website errorsRegisterClientScriptBlock vs RegisterStartupScript
Difference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript
S.No Page.RegisterClientScriptBlock Page.RegisterStartupScript 1 RegisterClientScriptBlock places the script at the top of the page right after the starting 'form' tag . RegisterStartupScript places the script at bottom of page right before the ending 'form' tag. 2 The code cannot access any of the form's elements because, at that time, the elements have not been instantiated yet.The code can access any of the form's elements because, at that time, the elements have been instantiated.3 RegisterClientScriptBlock is meant for functions that should be "available" to the page. For this they are rendered at the start of the HTML file. In this case the page content will be blocked.RegisterStartupScript is meant for commands that should execute on page load (at the client), so that page needs to be available for the script. This script is rendered at the end of the HTML file. In this case the content of the page will be diplayed first and then script will run.
Example for RegisterStartupScript:if (!Page.IsStartupScriptRegistered("CH"))Page.RegisterStartupScript("CH", "script goes here");Example for RegisterClientScriptBlock:if (!Page.IsClientScriptBlockRegistered("CH"))Page.RegisterClientScriptBlock("CH", "script goes here");Note:The choice of which method to use really depends on the "order" in which we want our script to be run by the browser when rendering the page.Take an example of a javascript function that populates a Textbox using a javascript function when a page is loaded. If we use the RegisterClientScriptBlock method, the javascript function will give an error. This is because our script is placed at the top of the page when it was loaded (when the textbox was not even created). So how can it find the textbox and populate the values. So in this case RegisterStartupscript should be used.UniqueID vs ClientID
Difference between UniqueID and ClientID
S.No UniqueID ClientID 1 Meaning:UniqueID is also a uniquely identifiable ID for a control but only used by ASP.Net page framework to identify the control.i.e., UniqueID = HTML's name attributeMeaning:ClientID is a unique ID string that is rendered to the client to identify the control in the output HTML.i.e., ClientID = HTML's id attribute2 Delimiter used:It uses $ to include parent controls (container) ID to make it unique.For example, ct100$ContentPlaceHolder1$txtLoginDelimiter used:It uses _ to include parent controls (container) ID to make it unique.For example, ct100_ContentPlaceHolder1_txtLogin.3 UniqueID Generation:Similar to ClientID, UniqueID is also generated by appending the parent container's(parent control) ID with the original control id but with $ delimiterClientID Generation:The client id for control will be generated by appending the parent container's(parent control) ID with the original control id with "_" as delimeter. In our example, ContentPlaceHolder1 is the ContentPlaceHolder ID of the master page which is the parent container for txtLogin.4 How to get UniqueID of a control ?For example, use txtLogin.UniqueID for ct100$ContentPlaceHolder1$txtLoginHow to get CientID of a control ?For example, use txtLogin.ClientID for ct100_ContentPlaceHolder1_txtLogin.5 Where to use ?The unique id is used by the ASP.NET framework to identify the control when the page is posted back to the server.Where to use ?The client id can be used to identify the control in client side scripting like javascript.
Note:ClientID = HTML's id attribute and so when doing getElementById, we should always give the ClientId.Instead, if we give UniqueID i.e., getElementById(Element's name), FireFox will fail.PlaceHolder vs ContentPlaceHolder
Difference between PlaceHolder and ContentPlaceHolder
S.No PlaceHolder ContentPlaceHolder 1 A PlaceHolder control is used as a container for any controls we wish to add and can be used on any page.A ContentPlaceHolder is used to hold content from Content Pages and can only be used on a Master Page.Panel vs PlaceHolder
Difference between Panel and PlaceHolder
S.No Panel PlaceHolder 1 What tag rendered in output ?Panel will render Div tags in the browerWhat tag rendered in output ?PlaceHolder will not render any tags2 Does it provide Styling Attributes ?Panel have the styling capabilites, so we can set the cssclass or style properties such as background-color, forecolor etc..Does it provide Styling Attributes ?Placeholder does not have any style attributes associated. We can not set cssclass or forecolor etc...3 Automatic Width Adjustment:Panel cannot adjust width automatically if controls are added in it.Automatic Width Adjustment:PlaceHolder can adjust width automatically if controls are added in it.4 Memory Size: Panel is heavy in memory size as compare to PlaceHolderMemory Size:PlaceHolder is light in memory size as compare to Panel.5 When to use ? If we want to use it to separate controls visually, then we have to use Panel control.When to use ? If we just want a container, without all the Display properties, then we have to use PlaceHolder control.Difference between URL and URI
Difference between a URL and a URI
S.No URL URI 1 URL stands for Uniform Resource LocatorURI stands for Uniform Resource Identifier2 URL is a subset of URI that specifies where an identified resource is available and the mechanism for retrieving it.Meachanism actually means one of the potocol schemes (e.g., http, ftp, file, mailto) provided by URI.A URI is a superset of URL that identifies a resource either by location (URL), or a name(URN), or both (URL and URN).
Examples for URL:• http:/www.dotnetfunda.com/users/login.aspxHere, http is the protocol, dotnetfunda.com is the domain name, users is the folder name, login.aspx is the filename• http://dotnetfunda.com/articles/default.aspxHere http is the protocol, dotnetfunda.com is the domain name, articles is the folder name and default.aspx is the file nameExamples for URI:• www.dotnetfunda.com• /some/page.htmlSummary:- A URI is either a URL or a URN.
- Every URL is a URI.
- Every URN is a URI.
- A URN is never a URL.
- A URL is never a URN.
- Every URI is not a URL
- If the URL describes both the location and name of a resource, the term to use is URI. Since this is generally the case most of us encounter everyday, URI is the correct term.
Here,URI --> A Uniform Resource Identifier(URI) is used to identify something on the World Wide Web.URN --> Uniform Resource Name (URN), a type of URI, basically states what something is, but do not have information on how to access it.URL --> Uniform Resource Locator (URL), a type of URI, contains the location of something and tell the client program (usually a browser) how to access it.ASP Session vs ASP.NET Session
Difference between ASP Session and ASP.NET Session
S.No ASP Session ASP.NET Session 1 Session type support:As ASP only supports InProc Session, so it cannot span across multiple servers.Session type support:ASP.NET supports both InProc and OutProc (StateServer and SQLServer) Sessions.Hence, it can span across multiple servers.2 Process dependency:In ASP, the session is Process dependent i.e., ASP session state is dependent on IIS process very heavily. So if IIS restartsASP session variables are also recycled.Process dependency:In Asp.Net, the session is Process independent i.e., ASP.NET session can be independent of the hosting environment thus ASP.NET session can maintained even if IIS reboots.3 Cookie dependency:In ASP, the session is Cookie dependent i.e., ASP session only functions when browser supports cookies.Cookie dependency:As ASP.NET supports Cookieless session, so the session in ASP.NET is Cookie independent.Authentication vs Authorization
Difference between Authentication and Authorization in ASP.NET
S.No Authentication Authorization 1 Meaning:Authentication is the process of verifying the identity of a user.Meaning:Authorization is process of checking whether the user has access rights to the system.2 Example:Suppose, we have 2 types of users ( normal and admins ) to a website. When the user tries to access the website, we ask them to log in. This is authentication part.Example:Once we know the user is valid, then we determine to which pages the user has access to. Normal users should not be able to access admin pages. This is authorization part.3 Types of Authentication:Windows AuthenticationForms AuthenticationPassport AuthenticationTypes of Authorization:ACL authorization (also known as file authorization)URL authorization4 Whent it takes place ?Authentication always precedes to Authorization,event if our application lets anonymous users connect and use the application,it still authenticates them as anonymous.Whent it takes place ?Authorization takes place after AuthenticationEnableViewState vs ViewStateMode
Difference between EnableViewState and ViewStateMode properties
S.No EnableViewState ViewStateMode 1 Property Introduction:EnableViewState exists from a long timeProperty Introduction:ViewStateMode property is introduced in ASP.NET 42 Available Values:EnableViewState property only accepts true or false valuesAvailable Values:ViewStateMode property can have a value of - Enabled, Disabled and inherit.3 Default Value:TrueDefault Value:Inherit4 What EnableViewState does ?To enable ViewState at Page levelWhat ViewStateMode does ?To enable ViewState at Control level5 How to use ?Using EnableViewState property we can have one of these 2 options.i. We can turn off view state altogether by setting its value to false in web.config file,orii.Enable viewstate for the entire pageand then turn it off on a control-by-control basis.How to use ?Steps involved to disable view state for a page and to enable it for a specific controlon the page,i. Set the EnableViewState property of thepage and the control to true,ii. Set the ViewStateMode property of thepage to Disabled, andiii. Set the ViewStateMode property of thecontrol to Enabled.Difference between STA and MTA
Difference between STA and MTA
S.No STA MTA 1 STA stands for Single Threaded Apartment MTA stands for Multi Threaded Apartment2 In STA,there may be multiple apartment.But only single thread can be executed in a apartment. In MTA, only one apartment will be there and all threads will execute within that single apartment. 3 In STA, if there is a need to communicate between threads we need a proxy, they can not do it directly. In MTA, threads communicate directly to each other without a proxy. 4 MTA applications execute slower than STA MTA applications typically execute faster than STA because there is less system overhead and can be optimized to eliminate system idle time. 5 If the COM object cannot handle its own synchronization i.e not thread safe then the STA model can be used If the COM object can handle its own synchronization then the MTA model can be used
Summary:An apartment is a logical container within a process for objects sharing the same thread access requirements.All objects in the same apartment can receive calls from any thread in the apartment.The .NET Framework does not use apartments, and managed objects are responsible for usingall shared resources in a thread-safe manner themselves.Weak-named vs Strong-named .NET components
Difference between Weak-named .NET components and Strong-named .NET components
S.No Weak-named .NET components Strong-named .NET components 1 Weak names are not guaranteed to be unique and thus cannot be shared without potentially causing conflicts. Strong names are digitally signed and provide a public key that ensures there are no conflicts.2 Weak-named .NET components must be individually copied to the /bin directories of the Web applications where they are used. Strong-named .NET components can be copied into the server’s GAC3 .NET components with weak names can call unmanaged code (such as COM components) and thus causes potential conflicts with dependencies. Furthermore, .NET components with strong names cannot call unmanaged code (such as COM components) and thus avoid potential conflicts with dependencies. Functions vs Methods
Difference between Functions and Methods
S.No Functions Methods 1 Functions do not have any reference variables Methods are called by reference variables2 All data that is passed to a function is explicitly passed It is implicitly passed the object for which it was called 3 It does not have access controlling i.e.,Function(other than static functions) declares and defines anywhere in the code It has access controlling i.e.,Method should declare and define in the class only4 Function applies to both object oriented and non-object oriented language(procedural language.eg. C, Scripting language eg; JavaScript etc) Method is only applicable to object oriented programming language like C++, C#, Java etc
0 Comments
Post a Comment