Showing posts with label basic concept. Show all posts
Showing posts with label basic concept. Show all posts

Saturday, June 30, 2012

What Is A Key? Describe Different Types Of Keys Used In Database?,define a relationship,



-A key is a single or combination of multiple fields.

-Its purpose is to access or retrieve data rows from table according to the requirement.

-The keys are defined in tables to access or sequence the stored data quickly and smoothly.

-They are also used to create links between different tables.

Primary Key


The attribute or combination of attributes that uniquely identifies a row or record in a relation is known as primary key.

Secondary key
-A field or combination of fields that is basis for retrieval is known as secondary key.

-Secondary key is a non-unique field. One secondary key value may refer to many records.

Candidate Key or Alternate key


-A relation can have only one primary key.

-It may contain many fields or combination of fields that can be used as primary key.

-One field or combination of fields is used as primary key.

-The fields or combination of fields that are not used as primary key are known as candidate key or alternate key.
-Composite key or concatenate key
A primary key that consists of two or more attributes is known as composite key.

Sort Or control key

-A field or combination of fields that is used to physically sequence the stored data called sort key. It is also known s control key.

Foreign Key


-A foreign key is an attribute or combination of attribute in a relation whose value match a primary key in another relation.

-The table in which foreign key is created is called as dependent table.

-The table to which foreign key is refers is known as parent table.

Comparison with 3tier architecture and MVC(model-view-controller) architecture



Both are smiler but topologically they are different.

-A Basic rule in a three tier architecture is the client tier never communicates directly with the data tier;
-in a three-tier model all communication must pass through the middle tier. Conceptually the three-tier architecture is linear

But


-MVC architecture is triangular

cycle in MVC(model-view-controller)

-view sends updates to the controller,

-the controller updates the model, and

-the view gets updated directly from the model.


3tier architecture and Multitier architecture



multi-tier architecture (often referred to as n-tier architecture) is a

client–server architecture in which

the presentation,
the application processing, and
the data management


are logically separate processes

The most widespread use of multi-tier architecture is the three-tier architecture.

There should be

a presentation tier,
a business or data access tier, and
a data tier.


Three-tier architecture


It was developed by John J. Donovan

The three-tier model is a software architecture and a software design pattern.

a change of operating system in the presentation tier would only affect the user interface code.





Presentation tier


-This is the topmost level of the application.

-The presentation tier displays information related to such services as browsing merchandise, purchasing, and shopping cart contents.

-It communicates with other tiers by outputting results to the browser/client tier and all other tiers in the network.

Application tier (business logic, logic tier, data access tier, or middle tier)

-The logic tier is pulled out from the presentation tier and, as its own layer, it controls an application’s functionality by performing detailed processing.

Data tier


-This tier consists of database servers.

-Here information is stored and retrieved.

-This tier keeps data neutral and independent from application servers or business logic. Giving data on its own tier also improves scalability and performance.


Data transfer between tiers is part of the architecture.

Protocols involved may include one or more of SNMP, CORBA, Java RMI, .NET Remoting, Windows Communication Foundation, sockets, UDP, web services or other standard or proprietary protocols.

Often middleware is used to connect the separate tiers.

Thursday, June 21, 2012

Cookies in asp.net : basic concept of Sessions,use of Sessions,how to use Sessions,need of Sessions in asp.net application...



Sessions can be used to store even complex data for the user just like cookies. Actually,

sessions will use cookies to store the data, unless you explicitly tell it not to. Sessions can be used easily in ASP.NET with the Session object.

We will re-use the cookie example, and use sessions instead.

Keep in mind though, that sessions will expire after a certain amount of minutes, as configured in the web.config file. Markup code:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Sessions</title>
</head>
<body runat="server" id="BodyTag">
    <form id="form1" runat="server">
    <asp:DropDownList runat="server" id="ColorSelector" autopostback="true" onselectedindexchanged="ColorSelector_IndexChanged">
        <asp:ListItem value="White" selected="True">Select color...</asp:ListItem>
        <asp:ListItem value="Red">Red</asp:ListItem>
        <asp:ListItem value="Green">Green</asp:ListItem>
        <asp:ListItem value="Blue">Blue</asp:ListItem>
    </asp:DropDownList>
    </form>
</body>
</html>


And here is the CodeBehind: 

using System;
using System.Data;
using System.Web;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(Session["BackgroundColor"] != null)
        {
            ColorSelector.SelectedValue = Session["BackgroundColor"].ToString();
            BodyTag.Style["background-color"] = ColorSelector.SelectedValue;
        }
    }

    protected void ColorSelector_IndexChanged(object sender, EventArgs e)
    {
        BodyTag.Style["background-color"] = ColorSelector.SelectedValue;
        Session["BackgroundColor"] = ColorSelector.SelectedValue;
    }
}


As you can see, the example doesn't need a lot of changes to use sessions instead of cookies.

Please notice that session values are tied to an instance of your browser. If you close down the browser, the saved value(s) will usually be "lost".

Also, if the webserver recycles the aspnet_wp.exe process, sessions are lost, since they are saved in memory as well.

This can be avoided by saving session states on a separate StateServer or by saving to a SQL server, but that's beyond the scope of this article.

source..

http://asp.net-tutorials.com/state/sessions/