Assignment: 4 Course Name:Web Programming: Submitted To: Paramjit Singh
Assignment: 4 Course Name:Web Programming: Submitted To: Paramjit Singh
Assignment: 4 Course Name:Web Programming: Submitted To: Paramjit Singh
Submitted to :
Paramjit Singh
Submitted by:
Vivek Jamwal
Sec: B2804
B43
PART A
Q1. Suppose you are given a task of adding a new record to the Customers table in the North wind database.
You first create a form that contains the fields you want to collect data from: Customer id, company name,
contact name, address, city, postal code, country. When the user presses the submit button the form is sent
to a file called "demo_add.asp". The "demo_add.asp" file contains the code that will add a new record to
the Customers table.
We want to add a new record to the Customers table in the North wind database. We first create a form that
contains the fields we want to collect data from:
<html>
<body>
<table>
<tr>
<td>Customer id:</td>
</tr><tr>
<td>Company Name:</td>
</tr><tr>
<td>Contact Name:</td>
</tr><tr>
</tr><tr>
</tr><tr>
<td>Zip Code:</td>
</tr><tr>
</tr>
</table>
</form>
</body>
</html>
demo_add.asp file:
<html>
<body>
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
conn.Execute sql,recaffected
if err<>0 then
else
end if
conn.close
%>
</body>
</html>
Q2. Suppose you r1e working on a table named “Customers” and you want to display the "Companyname"
and "Contactname" fields from the "Customers" table, ordered by "Companyname". Write the code snippet
to sort the records on a specified fieldname using the concept of ADO.
ANS:- <html>
<body>
<%set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
set r1 = Server.CreateObject("ADODB.recordset")
sql="SELECT Companyname, Contactname FROM
Customers ORDER BY CompanyName"
r1.Open sql, conn
%>
</body>
</html>
Q3. Suppose you want to send information from one page to another using the concept of cookies. But what
if a browser does not support cookies?
Answer:By using a form we can pass the information from one page to another. The form passes the user input
to "a1.asp" when the user clicks on the Submit button:
<%
name=Request.Form("name")
age=Request.Form("Age")
Response.Write("<p>Welcome " & name & ", Your age is: " & Age & " Thank you!</p>")
%>
PART B
Q4. Discuss the three tier architecture in ASP.NET. Does it help in increasing the reusability of code?
Answer: Three-tier application is a program which is organized into three major disjunctive tiers on layers.
These layers are-
3-Tier architecture generally contains UI or Presentation Layer, Business Access Layer (BAL) or Business Logic
Layer and Data Access Layer (DAL).
Yes, it definitely helps in increasing the reusability. How these layers increase the reusability of codes
explained below.
It generates all the code required for 3 tier architecture that can be directly used in Visual Studio .NET making
use of Web Template pattern and Error pattern. It Generates SQL procedures and scripts to create, add,
update and show records of the table. Generates code for both C# as well as VB.NET. It can do DataGrid
editing or separate update form. Makes use of cascading style sheets. Uses a standard Microsoft
recommended Microsoft Data Access Application Block for .NET. User controls r1e used for header and footer.
Unmanaged
Component
VB JS C++ C#
Compiler
Assembly Code
CLR
JIT Compiler
Native Code
Operating System
The managed execution process includes the following steps, which are discussed in detail later in
this topic:
Choosing a Compiler
Compiling to MSIL
Code Verification
Q6. Is IIS necessary for publishing the websites under ASP.NET environment? If yes, comment. Also discuss
that if you are working in ASP.NET on Linux platform then what would be used to publish the dynamic web
pages?
Answer: Yes! IIS is necessary for publishing the websites under ASP.NET. Without IIS we have to face difficulty
in publishing the web page.
For Linux platform we use these tools for making the dynamic pages:-
There is an application software named Mono which provides the platform to develop and run .NET client and
server applications on Linux. It can also be deployed on Solaris, Mac OS X, Windows, and Unix. Mono is dual
licensed by Novell, similar to other products such as Qt and the Mozilla Application Suite. Sponsored by Novell,
the Mono open source project has an active and enthusiastic contributing community and is positioned to
become the leading choice for development of Linux applications.
Some Mono Features
Multi-platform,
Now we come to the main essence of this article, i.e running ASP.NET applications on Linux.