1.
HEMCHANDRACHARYA NORTH GUJARAT UNIVERSITY, PATAN
B.C.A. Semester – V
BCA-506 : .NET Frame Work Using C#
Teaching
Scheme (per
week)
Teaching
Scheme (per
semester)
Examination Scheme
INT
EXT
TOTAL
Th.
(hours)
Pr.
(hours)
Total
Hours
Credit
Th.
(marks)
Pr.
(marks)
Th.
(marks)
Pr.
(marks)
Th.
(marks)
Pr.
(marks)
--
4
40
4
--
30
--
70
--
100
University Examination Duration: 3 Hours (Per Batch)
(Practical List)
1.
2.
3.
4.
5.
6.
7.
8.
Write the Steps for configure IIS with Asp.Net
Write an Asp.Net Program to print a Message on web form.
Write an Asp.Net Program to Create Simple Web Application using two or more web form.
Write an Asp.Net Program to set a link for new Page.
Write an Asp.Net program using different namespaces.
Write an Asp.Net Program to demonstrate different common Control.
Write an Asp.Net Program to demonstrate Request, Response and Server Object.
Write a program using delegation in which addition and subtraction of two integer value
possible.
9. Write an Asp.Net program using while or for loop to print sum of first 100 ODD and Even
Numbers.
10.Write an Asp.Net Program to add the value of Text Box in to Dropdown List and List box
Controls.
11.Write an Asp.Net Program to Delete Items from Dropdown list and List box.
12.Write an Asp.Net Program to set Image on Image Control according to selection of image
name from dropdown list.
13.Write an Asp.Net Program to demonstrate use of Master Page using Themes.
14.Write an Asp.Net Program to perform Insert and update operation in Database.
15.Write an Asp.Net program to perform Search and Delete operation in Database.
16.Write an Asp.net program to display the records from database using Data Reader
Object.
17.Write an Asp.Net Program to demonstrate the various methods of Dataset Object.
18.Write an Asp.Net Program to demonstrate Login Page using Database.
Practical Exam Scheme:
Program
Output
Viva
Journal
Total
25 Marks
15 Marks
20 Marks
10 Marks
70 Marks
Page. 1 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
2.
Practical: 1 - Write the Steps for configure IIS with Asp.Net
Installation of IIS in Windows XP
Windows XP does not generally have IIS installed by default, so it will probably have to be
done manually. To do so, follow these steps:
Step: 1 – Click on Start Button → Go to Control Panel, and open Add/Remove Programs.
Step: 2 – In the left side panel, click on Add/Remove Windows Components.
Page. 2 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
3.
Step: 3 – In the window Components Wizard, find the 'Internet Information Services (IIS)'
option and check it.
Step: 4 – Click on "Details" button. Ensure that 'World Wide Web Service' is checked. Select
other options as per your need and then click "OK".
Page. 3 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
4.
Step: 5 - Click on "Next" Button, the required files will begin to copy. we may be prompted
to insert the original Windows XP install CD, if we have not given windows XP Installation
disc or installation source.
Step: 6 - Once the file copy is complete, click "Finish".
Page. 4 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
5.
Now, In Control Panel, open 'Administrative Tools' and IIS should now be installed.
How to test IIS (Web Server) is successfully installed or not?
Open Web Browser and type http://localhost in the Address Bar. If web browser shows the
information about your IIS, then your web server (IIS) installed successfully.
Installation of IIS in Windows Vista and Windows 7
Step: 1 – Click on Start Button → Go to Control Panel.
Step: 2 – In the Control Panel click on programs or in the left side panel, select Classic View
and Open Programs and Features.
Page. 5 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
6.
Or
Step: 3 – In the left side panel, click on “Turn Windows features on or off” link. Or click on
“turn on or off windows features”.
Step: 4 - You may receive the Windows Security warning. Click Allow to continue. The
Windows Features dialog box is displayed.
Step: 5 - Expand Internet Information Services. Additional categories of IIS features are
displayed. Select Internet Information Services to choose the default features for
installation. Expand the additional categories displayed, and select any additional features
we want to install, such as Web Management Tools, FTP etc.
Page. 6 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
7.
Step: 6 – Click “OK” button at the bottom, and wait for installation to complete.
Page. 7 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
8.
IIS is now installed with a default configuration on Windows Vista or Windows 7.
Next, you can use Internet Information Services Manager to manage and configure IIS. To
open IIS Manager, click Start, type inetmgr in the Search Programs and Files box, and then
press ENTER.
Installation of IIS on Windows 8
Step: 1 - Press the Windows + R key combination to bring up a run box, then type
appwiz.cpl and press ok or press enter.
Step: 2 - This will open the Program and Features part of Control Panel, on the left hand
side click on the “Turn Windows features on or off” link.
Page. 8 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
9.
Step: 3 - Now click on the Internet Information Services check box. Select other options as
per your need and then click "OK".
Step: 4 - Click “OK” button at the bottom, and wait for installation to complete.
Page. 9 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
10.
How to test IIS (Web Server) is successfully installed or not.
Open Web Browser and type http://localhost in the Address Bar. If web browser shows the
information about your IIS, then your web server (IIS) installed successfully.
IIS 8 Successfully Installed on Windows 8.
Practical: 2 - Write an Asp.Net Program to print a Message on web form.
Practical_2.aspx
<html>
<head runat="server">
<title>Practical_2 Print a Message</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<i>Hello. This is your Practical-2 (Message from Source (.aspx))</i>
</div>
</form>
</body>
</html>
Page. 10 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
11.
Practical_2.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
string message = "This is your Practical-2 (Message from Code Behind
(.aspx.cs)->Variable)";
Response.Write("Hello. This is your Practical-2 (Message from
Code Behind (.aspx.cs))<br />");
Response.Write(message);
Response.Write("<br />");
Response.Write("<b>" + message + "</b>");
}
Output
Practical: 3 - Write an Asp.Net Program to Create Simple Web Application using
two or more web form.
Code: Practical-3.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>My Home Page</title>
<link href="webcss.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<table border="0" cellspacing="0" bordercolor="#FF6633" width="900px"
align="center">
<tr>
<td align="center"><img src="hponline.png" width="889px" /></td>
</tr>
<tr>
Page. 11 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
16.
Practical: 5 - Write an Asp.Net program using different namespaces.
First add a class file.
Right click on your web application from the solution explorer, click on add new item
Now we can see ‘add new item’ window. Select class and type the name of your file then
click on add button.
Now create your own custom namespace and class in the class file.
simplenm.cs
using
using
using
using
using
using
using
using
using
using
using
System;
System.Data;
System.Configuration;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
public class simplenm
{
public string simplenmclsfun()
{
return "<b>WELCOME TO your simplenm class. message return from
simplenmclsfun() function.</b>" + "<br />";
}
}
Page. 16 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
17.
namespace basiccalc
{
public class msgclass
{
public static string msgfun()
{
return "<b>WELCOME TO CUSTOME NAMESPACE. message return from
msgfun() </b>" + "<br />";
}
}
public class calc
{
public static int sum(int val1, int val2)
{
int getval1, getval2,sum;
getval1 = val1;
getval2 = val2;
sum = getval1 + getval2;
return sum;
}
public static int sub(int val1, int val2)
{
int getval1, getval2, sub;
getval1 = val1;
getval2 = val2;
sub = getval1 - getval2;
return sub;
}
public static int mul(int val1, int val2)
{
int getval1, getval2, mul;
getval1 = val1;
getval2 = val2;
mul = getval1 * getval2;
return mul;
}
public static int div(int val1, int val2)
{
int getval1, getval2, div;
getval1 = val1;
getval2 = val2;
div = getval1 / getval2;
return div;
}
}
}
Page. 17 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
18.
Default.aspx.cs
using
using
using
using
using
using
using
using
using
using
using
using
System;
System.Collections;
System.Configuration;
System.Data;
System.Linq;
System.Web;
System.Web.Security;
System.Web.UI;
System.Web.UI.HtmlControls;
System.Web.UI.WebControls;
System.Web.UI.WebControls.WebParts;
System.Xml.Linq;
// add your name space here to access all class and its memers functions.
using basiccalc;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// create clsmsgobj object to access simplenm class and its members.
simplenm clsmsgobj = new simplenm();
string clsmsg = clsmsgobj.simplenmclsfun();
Response.Write(clsmsg);
//msgclass is the created under the basiccalc namespace. msgfun() is the
member of msgclass
string getnmsg = msgclass.msgfun();
Response.Write(getnmsg);
int val1 = 50, val2 = 2;
Response.Write("Value of val1 is:" + val1 + ", Value of val2 is:" + val2 + "<br>");
//access functions from the calc class under the basiccalc namespace.
int sum = calc.sum(val1, val2);
int sub = calc.sub(val1, val2);
int mul = calc.mul(val1, val2);
int div = calc.div(val1, val2);
}
Response.Write("Sum is: " + sum + "<br>");
Response.Write("Subtraction is: " + sub + "<br>");
Response.Write("Multiplication is: " + mul + "<br>");
Response.Write("Division is: " + div + "<br>");
}
Page. 18 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
19.
Output:
WELCOME TO your simplenm class. message return from simplenmclsfun() function.
WELCOME TO CUSTOME NAMESPACE. message return from msgfun()
Value of val1 is:50, Value of val2 is:2
Sum is: 52
Subtraction is: 48
Multiplication is: 100
Division is: 25
Practical: 6 - Write an Asp.Net Program to demonstrate different common Control.
Code: Practical-6.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
Demostration of Different Common Controls...........<br />
Label Control:
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
TextBox Control:
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
Literal Control:
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
<br />
Button Control:
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Click Me" />
<br />
Link Botton Control:
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">Click
here to go HOME PAGE</asp:LinkButton>
<br />
Image Button Control:
<asp:ImageButton ID="ImageButton1" runat="server"
onclick="ImageButton1_Click" />
<br />
List Box Control:
<asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True"
onselectedindexchanged="ListBox1_SelectedIndexChanged"></asp:ListBox>
<br />
Drop Down List Control:
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
Page. 19 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
30.
Practical: 8 - Write a program using delegation in which addition and subtraction
of two integer value possible.
Delegate Example 1: Code:
delegate void Mdelegate1();
delegate string Mdelegate2();
public partial class practical_81 : System.Web.UI.Page
{
public void Callback1() // Does not return the value
{
Response.Write("Calling callback1 <br>");
}
public string Callback2() // Return the Value
{
return "Calling callback2";
}
protected void Page_Load(object sender, EventArgs e)
{
Mdelegate1 del1 = new Mdelegate1(Callback1);
del1();
}
Mdelegate2 del2 = new Mdelegate2(Callback2);
Response.Write(del2());
}
Output:
Page. 30 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
31.
Delegate Example 2: Code:
delegate int arithm(int x, int y);
public partial class practical_82 : System.Web.UI.Page
{
static int addition(int x, int y)
{
return x + y;
}
static int subtraction(int x, int y)
{
return x - y;
}
static int multiplication(int x, int y)
{
return x * y;
}
static int division(int x, int y)
{
return x / y;
}
static int dooperation(int x, int y, arithm delobj)
{
int result = delobj(x, y);
return result;
}
protected void Page_Load(object sender, EventArgs e)
{
int a=25, b=2;
Response.Write("Value of A is: " + a + " , Value of B is: " + b + "<br>");
Response.Write("Addition:" + dooperation(a, b, addition) + "<br>");
Response.Write("Subtraction:" + dooperation(a, b, subtraction) + "<br>");
Response.Write("Multiplication:" + dooperation(a,b,multiplication) + "<br>");
Response.Write("Division:" + dooperation(a, b, division) + "<br>");
}
}
Output:
Page. 31 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
32.
Delegate Example 3: Code:
public delegate double Delegate_eval(int a, int b);
public partial class practical_8 : System.Web.UI.Page
{
int v1 = 25;
int v2 = 2;
double result = 0;
static double fn_addvalues(int val1, int val2)
{
return val1 + val2;
}
static double fn_subvalues(int val1, int val2)
{
return val1 - val2;
}
static double fn_mulvalues(int val1, int val2)
{
return val1 * val2;
}
static double fn_divvalues(int val1, int val2)
{
return val1 / val2;
}
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Value of V1:" + v1 + ", Value of V2:" + v2 + "<br>");
Delegate_eval deladdObj = new Delegate_eval(fn_addvalues);
result = deladdObj(v1, v2);
Response.Write("Addition:" + result + "<br>");
Delegate_eval delsubObj = new Delegate_eval(fn_subvalues);
result = delsubObj(v1, v2);
Response.Write("Subtraction: " + result + "<br>");
Delegate_eval delmulObj = new Delegate_eval(fn_mulvalues);
result = delmulObj(v1, v2);
Response.Write("Multiplication: " + result + "<br>");
Delegate_eval deldivObj = new Delegate_eval(fn_divvalues);
result = deldivObj(v1, v2);
Response.Write("Division:" + result + "<br>");
}
}
Page. 32 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
33.
Output:
Practical: 9 - Write an Asp.Net program using while or for loop to print sum of first
100 ODD and Even Numbers.
Code:
public partial class practical_9 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int no, oddsum=0, evensum=0;
for (no = 1; no <= 100; no++)
{
if (no % 2 == 0)
{
evensum += no; // evensum = evensum + no;
Response.Write("<b>" + no + " is Even Number, Sum: " +
evensum + "</b><br/>");
}
else
{
oddsum += no; // oddsum = oddsum + no;
Response.Write("<i>" + no + " is Odd Number, Sum: " +
oddsum + "</i><br/>");
}
}
Response.Write("-------------------------Total is-------------<br />");
Response.Write("<b>Sum of First 100 Odd Number is : </b>" +
oddsum.ToString() + "<br />");
Page. 33 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
34.
}
Response.Write("<b>Sum of First 100 Even Number is : </b>" +
evensum.ToString() + "<br />");
}
Output:
Page. 34 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
35.
Practical: 10 - Write an Asp.Net Program to add the value of Text Box in to
Dropdown List and List box Controls.
Practical_10.aspx : Code
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>add the value of Text Box in to Dropdown List and List box Controls.</title>
</head>
<body>
<form id="form1" runat="server">
<div style="width: 466px" >
<asp:Label ID="Label1" runat="server" Text="Enter Value : "></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Width="224px"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Add to Drop Down" Width="142px" />
<asp:Button ID="Button2" runat="server" Text="Add to list Box" OnClick="Button2_Click"
Width="146px" /><br />
<asp:DropDownList ID="DropDownList1" runat="server" Height="19px" Width="139px">
</asp:DropDownList>
<asp:ListBox ID="ListBox1" runat="server" Height="105px" Width="143px"
style="margin-left: 10px"></asp:ListBox><br />
<b>Add the value of Text Box in to Dropdown List and List box Controls.
</b> </div>
</form>
</body>
</html>
Practical_10.aspx.cs : Code
public partial class practical_10 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Button1_Click(object sender, EventArgs e)
{
DropDownList1.Items.Add(TextBox1.Text);
}
protected void Button2_Click(object sender, EventArgs e)
{
ListBox1.Items.Add(TextBox1.Text);
}
Output:
}
Page. 35 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
36.
Practical: 11 - Write an Asp.Net Program to Delete Items from Dropdown list and
List box.
Practical_11.aspx: code
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Practical-11 Add to List box and dropdonbox</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<asp:Label ID="Label1" runat="server" Text="Enter Value : "></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Width="219px"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Add to
Drop Down" Width="144px" />
<asp:DropDownList ID="DropDownList1" runat="server" Height="22px"
Width="156px">
</asp:DropDownList>
<asp:Button ID="Button3" runat="server" Text="Click to Remove from Drop Down"
Width="265px" OnClick="Button3_Click" />
<br />
<asp:Button ID="Button2" runat="server" Text="Add to list Box"
OnClick="Button2_Click" Width="146px" />
<asp:ListBox ID="ListBox1" runat="server" Height="105px"
Width="161px"></asp:ListBox>
<asp:Button ID="Button4" runat="server" Text="Click to Remove from List Box"
OnClick="Button4_Click" />
</div>
</form>
</body>
</html>
Practical_11.aspx.cs: code
public partial class practical_11 : System.Web.UI.Page
{
// Practical-11 : Write an Asp.Net Program to Delete Items from Dropdown list and List
box.
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
DropDownList1.Items.Add(TextBox1.Text);
}
protected void Button2_Click(object sender, EventArgs e)
Page. 36 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
40.
Practical: 13 - Write an Asp.Net Program to demonstrate use of Master Page using
Themes.
How to Create Theme:
Step 1: Right Click on your web site.
Step 2: Select Add ASP.NET Folder.
Step 3: Click on Theme. Now App_Theme Folder is Created.
The Theme Folder is created automatically under the App_Theme just Rename and give the
name of theme which you want. If you want to create more theme Folder, follow step 1 to
step 3 again.
Page. 40 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
41.
Step 4: Now, Right Click on App_Theme Folder and select Add New Item.
Here you can see Add New Item Window. Select Style Sheet, give the name and click on add
button. Your css file is created.
Step: 5 Double click on css file and write the code below:
Code: Mycss.css
Body
{
background-color: Orange;
}
h1
{
font-size: 25px;
color: Blue;
}
p
{
background-color: Blue;
font-family: Arial, "Comic Sans MS", "Courier New", Verdana;
font-size: 20px;
}
Page. 41 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
42.
Step: 6 now, add a skin file for giving style to the server controls. Right Click on
App_Theme Folder and select Add New Item.
Here you can see Add New Item Window. Select Skin File, give the name and click on add
button. Your skin file is created.
Step: 8 now, Double click on skin file and write the code below:
Code: myskin.skin
<asp:TextBox runat="server" ForeColor="blue" Font-Size="30px" />
<asp:DropDownList runat="server" BackColor="blue" Width=”200px” />
<asp:Label runat="server" ForeColor="yellow" BackColor="blue" Font-Size="50px" />
Step: 9 open Source view of your .aspx file and write the code below or put textbox,
dropdownlist and label control in the web form.
Code: MasterPage.master
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<asp:ContentPlaceHolder id="head" runat="server">
Page. 42 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
43.
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>Master Page with Theme</h1>
<asp:Label ID="Label1" runat="server" Text="Label Control in Master Page...">
</asp:Label>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
<p>Demostration of Master page with Theme.</p>
</div>
</form>
</body>
</html>
Code: Practical-131.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="practical-131.aspx.cs" Inherits="practical_131"
Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<div>
<h1>Theme Example</h1>
<br />
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
</asp:DropDownList>
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</div>
</asp:Content>
Step: 10 Now, Open Web.config file and replace <pages> with <pages theme="blue">
If you have created more than one theme, then just replace the theme name in web config.
Ex. <pages theme=”blue”> or <pages theme=”moderntheme”> etc…
Open your web site, the theme will interact with you web page and it’s server Controls.
Page. 43 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
45.
Practical 14 : 15 : 16 : 17 : 18 -> practical-14.aspx
Write
Write
Write
Write
Write
an
an
an
an
an
Asp.Net Program to perform Insert and update operation in Database.
Asp.Net program to perform Search and Delete operation in Database.
Asp.net program to display the records from database using Data Reader Object.
Asp.Net Program to demonstrate the various methods of Dataset Object.
Asp.Net Program to demonstrate Login Page using Database.
How to create and Attach Database in our website.
First of all add App_Data Folder in our website. Here we will use database file and attach the
database to our web site.
Step: 1 In Solution Explorer: Right Click on Our website root -> goto Add ASP.NET Folder > and click on App_Data.
Step: 2 In Solution Explorer Right Click on App_Data -> click on Add New Item
Page. 45 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
46.
Step: 3 Select SQL Server Database, Write the name of Database and Click on Add Button.
We have successfully added new database to our website. Let’s check and open it to create
table.
Step: 4 Now Open Server Explorer and double click on our database.
Now we have opened database and connected to the database ‘emp’ . let’s create table in
our database.
Page. 46 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)
47.
Step:5 Right Click on Tables under our Database ‘emp’ and then click on “Add New Table”
Now Create Fields for our table.
Now save your table. Give the name of table “tabemp” and click on ‘OK’ Button. ‘tabemp’
table is created.
You can See table “tabemp” and it’s fields.
Page. 47 Prepared By: Hitesh Patel (Asst. Professor, GrowMore BCA/PGDCA)