Full Notes
Full Notes
Full Notes
NET
Unit-I
1)Getting Setup :
ASP.NET is a server-side Web application framework designed for Web
development to produce dynamic Web pages. It was developed by Microsoft to
allow programmers to build dynamic web sites, web applications and web
services.
How Dose Asp.net Fit.in
Asp.net is a part of the .net framework new computing platform
From Microsoft optimized for creating Application that
Are highly distributed across the internet.
What is .net Framework
.net is Microsoft name dor a platform for xml web service
.xml is a standard way for developing mark-up language that can describe any
kind of data or functionality.
What ate Active Server Page
Active server pages (asp) is the name Microsoft uses for a
Technology that is Convenient for Building Dynamic web page.
Dynamic Web Page Contain Content that may Change from Second to second
based on the data & Condition that may Change as Time progresses.
2) What is ASP.NET
ASP.NET is a server-side Web application framework designed for Web
development to produce dynamic Web pages. It was developed by Microsoft to
allow programmers to build dynamic web sites, web applications and web
services.
ASP.NET is a development framework for building web pages and web sites
with HTML, CSS, JavaScript and server scripting.
ASP.NET supports three different development models:
Web Pages, MVC (Model View Controller), and Web Forms:
Step 2: Click the Add button to add a new external tool menu item. Name it
Webserver on Port 8010 (or anything else you want).
Step 3: For the Command textbox setting enter this value:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\WebDev.WebServer.EX
E (note: this point to the web-server that VS usually automatically runs).
Step 4: For the Arguments textbox setting enter this value: /port:8010 /path:$
(ProjectDir) (or any port you like)
Step 5: Select the Use Output Window checkbox (this will prevent the
command-shell window from popping up.
Once you hit apply and ok you will now have a new menu item in your Tools
menu called WebServer on Port 8010. You can now select any web project in
your solution and then choose this menu option to launch a web-server that has
a root site on port 8010 (or whatever other port you want) for the project. You
can then connect to this site in a browser by simply saying
http://localhost:8010/. All root based references will work fine.
Step 6: The last step is to configure your web project to automatically reference
this web-server when you run or debug a site instead of launching the built-in
web-server itself. To-do this, select your web-project in the solution explorer,
right click and select property pages. Select the start options setting on the
left, and under server change the radio button value from the default (which is
use built-in webserver) to instead be Use custom server. Then set the Base
URL value to be: http://localhost:8010/
allow programmers to build dynamic web sites, web applications and web
services.
The most important difference between ASP and ASP.Net is that ASP
uses interpreted VBScript or JScript, and ASP.net uses any .Net language
(including VB.Net, C#, J#, etc.) compiled.
ASP 3.0 left all its code in the front of the application. There was no way
for a programmer to "hide" the sensitive code which he or she may not
want anybody to see. The fact that the code was interpreted also slowed
performance. ASP.NET allows the programmer to create dynamic link
libraries containing the sensitive code. This may be a disadvantage from
an open-source perspective but compiling code into dll's greatly improves
performance.
ASP is mostly written using VB Script and HTML intermixed.
Presentation and business logic is intermixed while ASP.NET can be
written in several .NET compliant languages such as C# or VB.NET.
ASP has maximum of 4 built in classes like Request, Response, Session
and Application whereas ASP.NET using .NET framework classes which
has more than 2000 in built classes.
ASP does not have any server based components whereas ASP.NET
offers several server based components like Button, TextBox etc. and
event driven processing can be done at server.
ASP doesn't support Page level transactions whereas ASP.NET supports
Page level transactions.
ASP.NET offers web development for mobile devices which alters the
content type (wml or chtml etc.) based on the device.
ASP.NET allows separation of business and presentation logic because
the code need not be included directly in the *.aspx page.
ASP.NET uses languages which are fully object oriented languages like
C# and also supports cross language support.
ASP.NET offers support for Web Services and rich data structures like
DataSet which allows disconnected data processing.
2.
3.
4.
5.
8)Program Flow
to maintain. See the topic titled Introduction to Web Forms Pages in the
ASP.NET SDK.
Converting ASP Applications to ASP.NET Applications
Please see the articles titled Migrating ASP Pages to ASP.NET and Microsoft
.NET/COM Migration and Interoperability in the ASP.NET SDK.
Converting ISAPI Applications to .NET HTTP Modules
HTTP Modules are equivalent to ISAPI filters. They enter the
execution pipeline before any handler sees the request and just after all handlers
have done their work. HTTP Handlers are equivalent to ISAPI extensions.
HTTP module classes must inherit the IHTTPModule interface. HTTP handlers
must inherit IHttpHandler. IIS executes an ISAPI filter by calling the
HttpFilterProc() method in the filter. ASP.NET executes code in a module in
response to an event in the execution pipeline such as Application_OnStart,
Session_OnStart or Session_OnEnd. When IIS issues a request to ASP.NET,
ASP.NET examines the <HTTPMODULES> and <HTTPHANDLERS> section
of all configuration files that apply to the application in order to find modules
and handlers that apply to the file name extension (.aspx, for example). If
modules or handlers are found, the request is routed to the appropriate code.
Unit-II
1)How Dynamic Website Applications work
(http://www.acunetix.com/websitesecurity/webapplications/)
A dynamic website contains information that changes, depending on the
viewer of the site, the time of the day, the time zone, the native language of the
country the viewer is in or many other factors.
A dynamic web site can contain client-side scripting or server-side
scripting to generate the changing content, or a combination of both scripting
types. These sites also include HTML programming for the basic structure. The
client-side or server-side scripting takes care of the guts of the site.
The three-layered web application model. The first layer is normally a
web browser or the user interface; the second layer is the dynamic content
generation technology tool such as Java servlets (JSP) or Active Server Pages
(ASP), and the third layer is the database containing content (e.g., news) and
customer data (e.g., usernames and passwords, social security numbers and
credit card details).
How the initial request is triggered by the user through the browser over
the Internet to the web application server. The web application accesses the
databases servers to perform the requested task updating and retrieving the
information lying within the database. The web application then presents the
information to the user through the browser.
For more information about these building blocks of a Visual Basic program,
see Solution and Project Basics and Assemblies and the Global Assembly Cache
(C# and Visual Basic).
File-Level Programming Elements
When you start a project or file and open the code editor, you
see some code already in place and in the correct order. Any code that you write
should follow the following sequence:
1. Option statements
2. Imports statements
3. Namespace statements and namespace-level elements
If you enter statements in a different order, compilation errors can result.
A program can also contain conditional compilation statements. You can
intersperse these in the source file among the statements of the preceding
sequence.
Option Statements
Option statements establish ground rules for subsequent code, helping
prevent syntax and logic errors. The Option Explicit Statement (Visual Basic)
ensures that all variables are declared and spelled correctly, which reduces
debugging time. The Option Strict Statement helps to minimize logic errors and
data loss that can occur when you work between variables of different data
types. The Option Compare Statement specifies the way strings are compared to
each other, based on either their Binary or Text values.
Imports Statements
You can include an Imports Statement (.NET Namespace and Type) to
import names defined outside your project. An Imports statement allows your
code to refer to classes and other types defined within the imported namespace,
without having to qualify them. You can use as many Imports statements as
appropriate. For more information, see References and the Imports Statement
(Visual Basic).
Namespace Statements
Description
Machine Name
Script Timeout
Description
AcceptTypes
ApplicationPath
Browser
ContentEncoding
ContentLength
ContentType
Cookies
FilePath
Files
Form
Headers
HttpMethod
InputStream
IsSecureConnecti
on
Description
Buffer
Buffer Output
Charset
Content Encoding
Content Type
Cookies
Expires
Expires Absolute
Header Encoding
Headers
IsClientConnected
Output
Output Stream
Description
Buffer
Buffer Output
Charset
Content Encoding
Content Type
Cookies
Expires
Expires Absolute
Header Encoding
Headers
IsClientConnected
Output
OutputStream
RedirectLocation
Status
StatusCode
StatusDescription
SubStatusCode
SuppressContent
Method
AddHeader
Description
Adds an HTTP header to the output stream. AddHeader
is provided for compatibility with earlier versions of
ASP.
AppendCookie
AppendHeader
AppendToLog
BinaryWrite
ClearContent
Close
End
Equals(Object)
Flush
GetType
Pics
Redirect(String)
Redirect(String,
Boolean)
SetCookie
ToString
TransmitFile(Strin
g)
Write(Char)
Write(Object)
Write(String)
WriteFile(String)
WriteFile(String,
Boolean)
Example:
The following simple example has a text box control where the user can enter
name, a button to send the information to the server and a label control to
display the URL of the client computer.
The content file:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs"
Inherits="server_side._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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Enter your name:<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server"
Description
ScriptTimeout
Methods
Methods
CreateObjet
Description
The CreateObject method creates an instance of the object (a
component, application or a scripting object) and returns a
reference to it. Once instantiated, this object's properties and
methods can be used just as you can use the properties and
GetLastError
HTMLEncode
MapPath
Transfer
URLEncode
Unit-III
1)Web forms & ASP.NET:
ASP.NET Web Forms
All server controls must appear within a <form> tag, and the <form> tag
must contain the runat="server" attribute. The runat="server" attribute indicates
that the form should be processed on the server. It also indicates that the
enclosed controls can be accessed by server scripts:
<form runat="server">
...HTML + server controls
</form>
Note: The form is always submitted to the page itself. If you specify an action
attribute, it is ignored. If you omit the method attribute, it will be set to
method="post" by default. Also, if you do not specify the name and id
attributes, they are automatically assigned by ASP.NET.
Note: An .aspx page can only contain ONE <form runat="server"> control!
If you select view source in an .aspx page containing a form with no name,
method, action, or id attribute specified, you will see that ASP.NET has added
these attributes to the form. It looks something like this:
<form name="_ctl0" method="post" action="page.aspx" id="_ctl0">
...some code
</form>
Submitting a Form
A form is most often submitted by clicking on a button. The Button server
control in ASP.NET has the following format:
<asp:Button id="id" text="label" OnClick="sub" runat="server" />
The id attribute defines a unique name for the button and the text attribute
assigns a label to the button. The onClick event handler specifies a named
subroutine to execute.
2)Web forms
Web form is the name Microsoft gives to specially designed asp.net
and html pages that include forms and the back end processing that support
them.
1. Programing web forms
web forms on other hand are a programing interface with objects and
properties and events act you disposal.
the stateless nature of the web
web form allow developers access to some method that presence value in
controls and asp.net contains object especially designed to provide control for
management of state as individual user session and as overall application.
<configSections>
<section name="section1" type="section1Handler" />
<section name="section2" type="section2Handler" />
</configSections>
<!-- Configuration section settings area. -->
<section1>
<s1Setting1 attribute1="attr1" />
</section1>
<section2>
<s2Setting1 attribute1="attr1" />
</section2>
<system.web>
<authentication mode="Windows" />
</system.web>
</configuration>
The Configuration Section Handler declarations:
The configuration section handlers are contained within the <configSections>
tags. Each configuration handler specifies name of a configuration section,
contained within the file, which provides some configuration data. It has the
following basic syntax:
<configSections>
<section />
<sectionGroup />
<remove />
<clear/>
</configSections>
<webParts>
<webServices>
<xhtmlConformance>
</system.web>
The following table provides brief description of some of common sub elements
of the system.web element:
Anonymous Identification:
This is required to identify users who are not authenticated when authorization
is required.
Authentication:
It configures the authentication support. Basic syntax:
<authentication mode="[Windows|Forms|Passport|None]">
<forms>...</forms>
<passport/>
</authentication>
Authorization
It configures the authorization support.Basic syntax:
<authorization>
<allow .../>
<deny .../>
</authorization>
Caching:
Configures the cache settings.Basic syntax:
<caching>
<cache>...</cache>
<outputCache>...</outputCache>
<outputCacheSettings>...</outputCacheSettings>
<sqlCacheDependency>...</sqlCacheDependency>
</caching>
Custom Errors:
Defines custom error messages. Basic syntax:
<urlMappings enabled="true|false">
<add.../>
<clear />
<remove.../>
</urlMappings>
Web Controls:
It provides the name of shared location for client scipts. Basic syntax:
<webControls clientScriptsLocation="String" />
Description
Item(name)
Count
Keys
Values
Control State:
Control state cannot be modified, accessed directly or disabled.
Session State:
When a user connects to an ASP.Net website, a new session object is created.
When session state is turned on, a new session state object is created for each
new request. This session state object becomes part of the context and it is
available through the page.
Session state is generally used for storing application data like inventory or
supplier list, or a customer record or shopping cart. It can also keep information
about the user and his preference and keep track of pending operations.
Sessions are identified and tracked with a 120-bit SessionID, which is passed
from client to server and back as cookie or a modified URL. The SessionID is
globally unique and random.
The session state object is created from the HttpSessionState class, which
defines a collection of session state items.
The HttpSessionState class has the following properties:
Properties
Description
SessionID
Item(name)
The value of the session state item with the specified name.
This is the default property of the HttpSessionState class
Count
TimeOut
Application State
An ASP.Net application is the collection of all web pages, code and other files
within a single virtual directory on a web server. When information is stored in
application state, it is available to all the users.
To provide for the use of application state, ASP.Net creates an application state
object for each application from the HTTPApplicationState class and stores this
object in server memory. This object is represented by class file global.asax.
Application State is mostly used to store hit counters and other statistical data,
global application data like tax rate, discount rate etc and to keep track of users
visiting the site.
Description
Item(name)
Count
accessed from any page. The information can also be changed in one place, and
the changes will automatically be reflected on all pages.
The Application object's collections, methods, and events are described below:
Collections
Collection
Contents
StaticObjects
Description
Contains all the items appended to the application through a script
command
Contains all the objects appended to the application with the HTML
<object> tag
Methods
Method
Contents.Remove
Contents.RemoveAll()
Lock
Unlock
Events
Event
Application_OnEnd
Application_OnStart
Description
Deletes an item from the Contents collection
Deletes all items from the Contents collection
Prevents other users from modifying the variables in the
Application object
Enables other users to modify the variables in the Application
object (after it has been locked using the Lock method)
Description
Occurs when all user sessions are over, and the application ends
Occurs before the first new session is created (when the
Application object is first referenced)
6)ASP sessions
The Primary Different Between A session And An Application is that the
application is glabal while the session is local to its user variable found in the
session are accessible only by the user who started the session
Session in asp.net
Session are created in a manner similar to asp sessions using a 120-bit
string that is unique any very difficult to generate maliciously .
Enabling and Disabling asp sessions
Processing Cookies from server Consumes From Server Processing
Directive.
<%ENABLESSIONSTATE=false%>
It used to turn off Session for the Entire Application.
Description
Contains all the items appended to the session through a script command
Contains all the objects appended to the session with the HTML
<object> tag
Description
Specifies the character set that will be used when displaying dynamic
content
LCID
SessionID
Timeout
Methods
Method
Abandon
Contents.Remove
Contents.RemoveAll()
Events
Event
Session_OnEnd
Session_OnStart
Description
Destroys a user session
Deletes an item from the Contents collection
Deletes all items from the Contents collection
Description
Occurs when a session ends
Occurs when a session starts
Unit-IV
ASP.NET objects and components:
1)The Scripting Object Model
The Scripting Object Model
To make Web application development faster and easier, Microsoft
Visual InterDev provides the scripting object model, which simplifies Web
application development by introducing a familiar object-oriented programming
model to HTML and script programming. The model also greatly reduces the
complexity and quantity of scripting required to write applications involving
interaction between client (browser) and server.
The Visual InterDev scripting object model defines a set of objects with events,
properties, and methods that you can use to create and script your application.
You can create the visual interface for your application using design-time
controls, and then write script to control the application using familiar objectoriented techniques.
The scripting object model allows you to create Web applications in much the
same way you create applications in environments such as Microsoft Visual
Basic and Microsoft Access.
The scripting object model is easiest to understand if you compare the scripting
object model with how Web applications are created using the combination of
ASP and HTML. To create a form, for example, you place HTML elements on a
page, including text boxes, list boxes, and buttons. One of the buttons is
typically a Submit button, which causes the form to be sent to the server, and
which specifies an ASP page containing server script to process the form.
Scripts on the destination page must manually examine the state submitted by
the browser, and there is no association with the object that created the state.
Advantages of the Script Object Model
The scripting object model provides these advantages:
Rapid application development using a familiar object-oriented
model. You can apply standard object-oriented techniques to developing
Web applications. Because you have to write less script and can use
simpler script, you can create applications more quickly and with fewer
errors.
Browser and platform independence. You can use the scripting object
model no matter what browsers will access your application. It works
virtually the same whether you design your applications for server script
(for maximum reach) or client script (for a better user experience, such as
less flashing and fewer round trips to the server).
Simplified forms. You can create forms by dragging design-time
controls onto a page in the same way you do in environments such as
Visual Basic, and change their appearance and behavior using properties.
You can process forms by writing standard event handlers and by calling
methods the scripting object model handles the complexities of
posting the form and dispatching to the correct form-handling logic.
Isolated application logic. You can more easily isolate your application
logic in discrete procedures including procedures on other pages
rather than mingling it with user interface and navigation elements.
State maintenance. The scripting object model provides a mechanism
for retaining the state of objects as control is transferred between the
client and server. You do not have to manually manage state in hidden
fields or session variables.
Data binding. The scripting objects can be bound to database fields so
you can use them for data-entry and data-editing forms.
Simplified page navigation. The scripting object model provides a
mechanism that allows you to navigate to another page by name rather
than specifying the URL of the target page, and that can jump directly to
any procedure on the page.
Remote scripting. You can execute server scripts from a page without
navigating off the page. As in traditional client/server applications, this
allows browser scripts to ask the server for a set of results, which can
then be used in the browser for further calculations or to alter the page
through DHTML.
Components of the Scripting Object Model
When you use the scripting object model, you work with a variety of objects.
You use the same objects whether you are writing server-based applications
(in .asp files) or pages with script that will be executed on the client browser
(.htm files).
Enabling the Scripting Object Model
Before you can use the scripting object model, you must enable it, which
constructs the scripting object model framework for the page.
capture business rules and access to data (the second and third tiers in 3-tier
client/server programming).
The important thing to stress here, however, is that server-side can, if properly
implemented, create client-side scripts. One of the most important questions in
Internet development is the one that makes you choose between programming
to the broadest audience and programming for the richest on-line experience. To
the extent that you choose the former, server-side scripting is important for two
reasons:
For example, the thinnest client on the Internet is the one that cannot render
graphics of any kind. The ALT parameter of the IMG tag in HTML originally
was intended to help such clients interpret important parts of the screen that
they otherwise couldn't see, by describing the area in words instead of an image.
With an Active Server Page, your application can sense when such a browser
(for that's what these kinds of programs are-as opposed to Web client programs
that have more processing power) is making a request of your Web site. You can
then present such graphics-challenged browsers with whole paragraphs, not
merely short expressions, to give them as much information as possible, given
their inherent limitations.
In today's Internet, a major difference between Web clients brands is
whether they recognize ActiveX controls or not. Again, the Active Server Page
doesn't care one way or the other. If it senses the ability to interpret ActiveX
controls, it presents them; otherwise, it includes static images (or text, if
necessary).
Of far greater importance than these mundane issues is the fact that Active
Server Pages promote a new level of processing power into the Web server. It is
critical to remember that the Web server was never designed to be an
application server. It was designed to deliver HTML. This remains its primary
mission, even on the Active Platform, but with Active Server Pages, this design
constraint ceases to be a constraint at all.
The scripts that are contained in Active Server Pages, especially those
driven by Active Server components, bring virtually all the power of traditional
client/server programming to the Web server. Indeed, to the extent that Active
Server components are utilized, Active Server Pages can do things that even the
most sophisticated client/server programs can't.
Components
Components may be the single most important feature of Active Server Pages.
Their importance to ASP is understandable when you step back and see how
pervasively Microsoft has embraced components in virtually everything they
create. Everything from the Internet Explorer to Windows NT 5.0 has been
"componentized" by Microsoft engineers. Components give programmers many
advantages, including lower development time and cost, added flexibility, easier
maintenance, and most important, easy scaleability.
For the ASP development community, on the server-side, server components are
either intrinsic to the Active Server or they are user-defined. On the client-side,
ActiveX controls provide functionality similar to server components.
Active Server Components
Active Server Components basically do two things. First, they directly expose
operating system services to your Active Server Pages. Second, they
encapsulate business rules in a way that is extremely easy to program. Perhaps
even more important in the long run, Active Server Components are easy to
create. That is, by using programming tools and environments optimized to
work with the Active Platform, writing sophisticated server components is no
longer the province of the advanced programmer.
There is a truism in programming that the best programmers are users. Active
Server components will prove that not only to be true but important, as well. In
the summer of 1996, it was estimated that the number of lines of Visual Basic
code finally exceeded the number of lines of code written in COBOL, the
perennial champ. Perhaps the biggest reason Visual Basic is so prolific is that
users, not professional programmers, wrote these "extra" lines of code. Active
Server component development will bring the same ease of programming to the
Internet that Visual Basic brought to creating Windows programs.
To get a feel for what server components are and what they do, take a look at a
few of those that ship with the Active Server.
The Browser Capabilities component is the component that permits an Active
Server Page to determine what kind of browser or Web client program is
making a request. It makes this determination by looking to the User Agent
HTTP header and looking up the identified browser in the browscap.ini file. All
of the listed features of the browser are exposed as properties of the Browser
Capabilities component.
The Browser Capabilities component is a clever piece of code, but it doesn't
have anything to do with the operating system. One component that does get
Going back to VBScript and JavaScript, a common question that has been asked
is "what is the best scripting language, VBScript or JavaScript?" In reality, there
is no "better" scripting language. It all depends on what context you ask the
question. Here are some of the factors you may want to consider before settling
on one.
These components are should already be installed and ready for use when
you install IIS 5.0
2. The counter component
The counter component is single components that can be used easily
create any number of individual counters for an application.
Counter components methods
The counters component has methods for creating counters and retrieving
their values, as well as incrementing or setting values and removing counters
altogether.
Get(counter)- This method returns the current value of whatever counter
their values
2. Graphical guide
Unit-V
1)Web services & ASP. NET
A web service is a web-based functionality accessed using the
protocols of the web to be used by the web applications. There are three aspects
of web service development:
Creating the web service
Creating a proxy
Consuming the web service
Creating the Web Sevice:
A web service is an web application which is basically a class consisting of
methods that could be used by other applications. It also follows a code-behind
architecture like the ASP.Net web pages, although it does not have an user
interface.
To understand the concept let us create a web service that will provide stock
price information. The clients can query about the name and price of a stock
based on the stock symbol. To keep this example simple, the values are
hardcoded in a two-dimensional array. This web service will have three
methods:
A defaullt HelloWorld method
A GetName Method
A GetPrice Method
Take the following steps to create the web service:
Step (1): Select File--> New --> Web Site in Visual Studio, and then select
ASP.Net Web Service.
Step (2): A web service file called Service.asmx and its code behind file,
Service.cs is created in the App_Code directory of the project.
Step (3): Change the names of the files to StockService.asmx and
StockService.cs.
Step (4): The .asmx file has simply a WebService directive on it:
<%@ WebService Language="C#"
CodeBehind="~/App_Code/StockService.cs"
Class="StockService" %>
Step (5): Open the StockService.cs file, the code generated in it is the basic
Hello World service. The default web service code behind file looks like the
following:
Step (6): Change the code behind file to add the two dimensional array of
strings for stock symbol, name and price and two web methods for getting the
stock information.
Step (7) : Running the web service application gives a web service test page,
UDDI
Discovery
Setting up a database
This section describes how to set up the SQL Server database by using the
command line tool sqlcmd, which is provided with the SQL Server installation.
You can also use a visual tool, such as SQL Server Studio Management, which
is also available for the Express version as SQL Server Studio Management
Express. See the SQL Server documentation or an SQL Server database
administrator (DBA) for more information.
To set up an SQL Server database by using the command tool sqlcmd:
1. Create a database. From the command line tool, type:
2. CREATE DATABASE jazz
GO
3. Create a user and password and change the ownership of the database.
From the command line tool, type:
4.
5.
6.
7.
8. Change the collation of the database. From the command line tool, type:
9. ALTER DATABASE jazz COLLATE
SQL_Latin1_General_CP437_CS_AS
GO
To set up a connection
1 In Borland Data Provider: Connections Editor, select the appropriate
item from the Connections list.
1 In Connection Settings, enter the Database path.
Note: If referring to a database on the local disk, prepend the path with
localhost:
. If using Interbase, for example, you would enter the path to your
Interbase database: localhost:C:\Program
Files\Borland\Interbase\Examples\Database\employee.gdb (or whatever
the actual path might be for your system).
1 Complete the UserName and Password fields for the database as needed.
1 Click Test to confirm the connection. A dialog appears confirming the
status of the connection.
1 Click OK to return to the Borland Data Provider: Connections Editor
dialog.
1 Click OK to return to the Data Adapter Configuration dialog. In the
Command tab, the areas for Tables and Columns are updated with
information from your connection.
To set a command
1 In the Select area, enter an SQL command.
Tip: For Interbase's employee.gdb database, you might enter select *
from SALES
, as an example.
1 Click the Preview Data tab.
1 Click Refresh. Column and row data appear.
1 Click the DataSet tab.
1 Confirm that New DataSet is selected.
description of SQL, its origins, basic concepts and components, and a lot of
examples. The book follows the specifications of the SQL:2011 standard, which
is developed by a common committee of ISO and IEC. Their publications are
not freely available. But you may want to refer to a working draft of SQL:2008,
which you can download from Whitemarsh Information Systems Corporation.
Characteristics
The tokens and syntax of SQL are oriented on English common speech to keep
the access barrier as small as possible. A SQL command like UPDATE
employee SET salary = 2000 WHERE id = 511; is not far away from the
sentence "Change employee's salary to 2000 for the one with id 511."
The next simplification is that all key words of SQL can be expressed in any
combination of upper and lower case characters someone prefers. It makes no
difference whether you write UPDATE, update, Update, UpDate or any other
combination of upper and lower case characters. The keywords are case
insensitive.
Next SQL is a descriptive language, not a procedural one. It does not predecide all aspects of the relational operations (which operation, their order, ...)
which are generated from the given SQL statement. The rDBMS has the
freedom to generate more than one execution plan from it and run this one it
thinks is the best in the given situation. Additionally the end user is freed from
all the gory details of data access, e.g.: Which one of a set of WHERE criteria
should be evaluated first if they are combined with AND?
Despite those simplifications SQL is very powerful. Especially it allows the
manipulation of a set of data records with one single statement. UPDATE
employee SET salary = salary * 1.1 WHERE salary < 2000; will affect all
employee records with an actual salary smaller than 2000: there may be
thousands of those records, only a few or even zero. And you may have
recognized that the operation is not a fixed manipulation. The wording SET
salary = salary * 1.1 leads to an increase of the salaries by 10%, which may be
120 for one employee and 150 for another one.
The designer of SQL tried to define the language elements orthogonally to each
other. Among other things that means that any language element may be used at
all positions of a statement where the result of that element may be used
directly. E.g.: If you have a function power() which takes two numbers and
returns another number, you can use this function at all places where numbers
are allowed. The following statements are syntactically correct (if you have
defined the function power() ) - and they lead to the same data records, but this
aspect is not important here.
SELECT salary FROM employee WHERE salary < 2048;
SELECT salary FROM employee WHERE salary < POWER(2, 11);
SELECT POWER(salary, 1) FROM employee WHERE salary < 2048;
Another example of orthogonality is the use of subqueries within UPDATE,
INSERT, DELETE or inside another SELECT statement.
Nevertheless SQL is not free of redundancy. Often there are a lot of choices
you can choose from to express the same situation.
SELECT salary FROM employee WHERE salary < 2048;
SELECT salary FROM employee WHERE NOT salary >= 2048;
SELECT salary FROM employee WHERE salary BETWEEN 0 AND 2047.99;
is a simple example. In complex statements you may have the choice between
joins, subqueries and the exists construct.
Fundamentals
Core SQL consists of statements. Statements consist of key words, operators,
values, names of system and user objects or functions. They are concluded by a
semicolon. In the statement SELECT salary FROM employee WHERE id <
100; the tokens SELECT, FROM and WHERE are key words. salary, employee
and id are object names, the "<" sign is an operator and "100" is a value.
The SQL standard arranges statements into 9 groups:
"The main classes of SQL-statements are:
SQL-schema statements; these may have a persistent effect on the set of
schemas.
SQL-data statements; some of these, the SQL-data change statements,
may have a persistent effect on SQL data.
SQL-transaction statements; except for the <commit statement>, these,
and the following classes, have no effects that persist when an SQLsession is terminated.
SQL-control statements.
SQL-connection statements.
SQL-session statements.
SQL-diagnostics statements.
SQL-dynamic statements.
SQL embedded exception declaration."
This detailed grouping is unusual in common speech. Usually we distinguish
between three groups:
Data Definition Language (DDL): Managing the structure of database
objects (create/drop tables, views, columns, ...)
Data Manipulation Language (DML): Managing and retrieval of data
with the statements INSERT, UPDATE, DELETE, SELECT, COMMIT
and ROLLBACK.
Data Control Language (DCL): Managing access rights.
Hint: In some publications the SELECT statement is said to build its own group
Data Query Language. This group has no other statements than SELECT.
Turing completeness
Core SQL as described above is not Turing complete. It misses conditional
branches, variables, subroutines. But the standard as well as most
implementations offers an extension to fulfill the demand for Turing
completeness. In 'Part 4: Persistent Stored Modules (SQL/PSM)' of the standard
there are definitions for IF-, CASE-, LOOP-, Assignment- and other statements.
The existing implementations of this part have different names, different syntax
and also a different scope of operation: PL/SQL in Oracle, SQL/PL in DB2,
Transact-SQL or T-SQL in MS-SQL and Sybase, PL/pgSQL in Postgres and
simply 'stored procedures' in MySQL.
REFERENCE BOOKS:
1.Dave Mercer, ASP. NET a Beginners Guide, Tata McGraw Hill Pub.
Company Ltd, 2002
2. Matt J. Couch, ASP. NET and VB. NET Web programming , Pearson
Education, 2002.
3..Kirk Allen Evans, Ashwin Kamanna, Joel Mueller, XML and ASP.NET,
Pearson
Education, 2002.
Created By
WHB
(www.whbforhelp.tk)