DOT NET WEB APPLICATION NOTES
REVIEW
POINT:-
1.basic
Dotnet fundamental
2.Dot net
framework environment
3.textbox
control
4.dropdown
list control
5.radio
button list control
6.date
and time concept
7.naviagtion
8.multi-view
9.state
management (session and Query string)
10.
cookies and view state
.DOT NET WEB APPLICATION
DEVELOPMENT:-
-DOT NET IS SUPPORT WEB APPLICATION DEVELOPMENT
-in dotnet frame work create web application using
ASP dotnet web
application (dot net frame work)
HOW TO CREATE 1 WEB APPLICATION IN DOT NET FRAMEWORK:-
-File-> new -> project -> ASP.NET WEB Application
(dot net frame work) -> select browse -> folder select -> ok ->
select Empty -> ok ->
WEB APPLICATION ENVIRONMENT:-
-there are following environment use in web application
1- solution explorer - all resources ( file, folder,
library display in solution explorer)
2- server explorer – server explorer is representing
data base working
3- property window – represent all attributes
(colour, height, width etc.)
4- tool box – all types of control present in a tool
box.
ACTIVE ENVIRONMENT WINDOW:-
-All window is to be activated view menu.
HOW TO RESATE ALL WINDOW:-
-in this concept using window menu and select reset window
layout option.
DEVELOPMEMENT ENVIRONMENT:-
-there are following area used in development environment.
1- design area. – (using .ASPX Page)
2- source area. – (automatic created in HTML format)
3- code area. – it use c# language(.CS)
EXTENTION OF WEB APPLICATION:-
1.
.ASPX
2.
.CS
3.
.HTML
4.
.JS
5.
.CSS
6.
.CONFIG
7.
.MASTER
8.
.ASX
9.
.CSHTML
HOW TO CREATE FIRST WEB FORM IN .DOTNET FRAMWORK:-
-All web form is to be save .ASPX Extensions
EX.
- About.ASPX
-Contact.ASPX
-ETC,
- In dotnet frame
work is to be save (default) -first page of application.
STEPS:-
-go to solution explorer -> right click on your route
folder (bold letter) -> click add option -> click new item -> select
web option -> select web form -> than name change -> add/ ok.
-
-All
.net tools is used standard category
Control
Property:-
-
In
.net framework is use one common property to all control is called “text”
-
By
default .net is used to local host
server
-
In
case of running mode we have to use debug option
Revised
:
1)
New
application create and save to the
folder
2)
Create
web form (default.aspx)
3)
Create
text box
4)
Create
button
5)
Design
window \ source window
6)
Tabbing
Addition
Of Two numbers :-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial
class _default : System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
}
protected void
Button1_Click(object sender, EventArgs e)
{
//
addition of two number
int a, b,
c;
a =
int.Parse(TextBox1.Text);
b =
int.Parse(TextBox2.Text);
c = a + b;
TextBox3.Text = c.ToString(); // display any types of data, decimal data
inside the control using toString()
}
}
}
**
TEXTBOX :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial
class _default : System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
}
protected void
Button1_Click(object sender, EventArgs e)
{
//
addition of two number
int a, b,
c;
a =
int.Parse(TextBox1.Text);
b =
int.Parse(TextBox2.Text);
c = a + b;
TextBox3.Text = c.ToString(); // display any types of data, decimal data
inside the control using toString()
// clear
textbox controls
TextBox1.Text = "";
TextBox2.Text = ""; // clear control
// How to
set cursor in a textbox control
// In .net
framework cursor is called focus
TextBox1.Focus();
// how to
change background color in textbox
// In .net
framework all color store inside the drawing library
TextBox3.BackColor = System.Drawing.Color.Yellow;
// IN c
programming support only 16 color
// In .net
support 256 and above color
//How to
break cursor inside the textbox control
// In this
concept using readOnly property
TextBox3.ReadOnly = true;
}
}
}
** OTHER PROPERTY OF TEXBOX:-
1) TextMode property (single line,multi
line ,password)
2) Visible property (height, show box )
--------------------------------------------------------------------------------------------------------------------------------
date:- 9/6/2025
** .Net Navigation:-
-
Navigation
is a process for visit one page to an other page
-
There
are two types of method used in navigation
1) Navigation using control
2) Navigation using code
1) Navigation using control:-
-There are
fallowing control used in navigation
1)
LinkButton control
2)hyperlink
Control
3)
imageButton control
1) LinkButton control:-
-There are
two property used in linkButton control
a) Text –
any type of massage
b)
PostBackURL – set your page name
2) HyperLink Control:-
-In this
control used to connect web URL (https/http)
-There are
two property used in hyperlink control
a) Text
b)
NavigateURL
2)Navigation
Using code:-
-
In
this concept using Response.Redirect()
-
Syntax:
Response.Redirect(“pageName.aspx”)
Program:-
protected void Button1_Click(object sender, EventArgs e)
{
//
navigation using code
Response.Redirect("default.aspx");
}
** Date and Time concept:-
-In this concept using DateTime library
protected void Button2_Click(object sender, EventArgs e)
{
// date
and time implemention
// display
current date and time
Label1.Text = DateTime.Now.ToString();
// display
only date
Label1.Text = DateTime.Now.ToString("dd/MM/yyyy");
// display
only month
Label1.Text = DateTime.Now.ToString("MMMM");
// display
only year
Label1.Text = DateTime.Now.ToString("yyyy");
// how to
increase days
Label1.Text = DateTime.Now.AddDays(5).ToString("dd/MM/yyyy");
//How to
increase year
Label1.Text = DateTime.Now.AddYears(2).ToString("yyyy");
// How to
increase month
Label1.Text = DateTime.Now.AddMonths(3).ToString("MMMM");
}
-----------------------------------------------------------------------------------------------------------------------------------
Date:-11/06/2025
DROPDOWN LIST
CONTROL:-
-dropdown
list is collection of data item.
-there are
following implementation used in dropdown list.
How to
add data item in dropdown list :-
-steps=
select dropdown listà click arrow symbol à click edit item à
**How to
Work Dropdown list Event :-
-if we have
to use event in dropdown list control than using AutoPostBack Property=true
HOW TO MATCH DROPDOWN LIST ELEMENT:-
-in this
concept using index method.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial
class Productlist : System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
}
protected void
Button1_Click(object sender, EventArgs e)
{
// Add New
City With User Choice
DropDownList1.Items.Add(TextBox1.Text);
}
protected void
DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
// Display
Dropdown list data to Textbox Control
//
TextBox1.Text = DropDownList1.Text;
//How to
match dropdown element
if(DropDownList1.SelectedIndex==1)// 1 representing pune
{
TextBox1.Text = "welcome";
}
else
{
TextBox1.Text = "Invalid";
}
}
protected void
Button2_Click(object sender, EventArgs e)
{
// Clear
Dropdown List
DropDownList1.Items.Clear();
}
}
}
Assignment on
Textbox,date and Time, DropdownList
Task1:
Task2:
Task3:
Task4:
Task5:
Task6:
RADIO BUTTON LIST CONTROL :-
-IN this
control is use to select one data item at a time.
-all
functionality is similar to dropdown list control.
CONTAINT MANAGEMENT:-
-Containt
management is a process is used to display multiple pages in single screen.
- Containt
management is used to multi view control.
- Inside
the multi view control create a other control called view.
-User can
create multiple view as per contain.
PROPERTY OF MULTI- VIEW :-
-Only one
property is used (Active View Index) Because Multi View is used to Array
Property In this Reason active View Window Property Is Zero.
-View 1-0 (starting
from always zero)
-View 2-1
-view 3-2
-View 4-3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial
class Containt_management : System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
}
protected void
MultiView1_ActiveViewChanged(object sender, EventArgs e)
{
}
protected void
Button2_Click(object sender, EventArgs e)
{
//display
view 1
MultiView1.ActiveViewIndex = 1;
}
protected void
Button3_Click(object sender, EventArgs e)
{
//display
view 2
MultiView1.ActiveViewIndex = 2;
}
protected void
Button4_Click(object sender, EventArgs e)
{
//display
view 3
MultiView1.ActiveViewIndex = 3;
}
protected void
Button1_Click(object sender, EventArgs e)
{
//active
View 1
MultiView1.ActiveViewIndex = 0;
}
}
}
HOW TO
DISPLAY IMAGE IN WEB APPLICATION:-
-In this
concept using image control.
-display
image in image-control using image URL property.
image1.
ImageURL=”pic name.”
Ex.
Image1.imageURL=”A1.jpg”
STATE MANAGEMENT:-****
-state
management is concept for use to transferring data between one page to other
page
-there are
following state management is used in DOT Net framework-
1. session
2.
QueryString
3.
application state
4.View
state
5.cookies
1.
session :-
-session is used to transfer data
between one page to another page.
-session is
use to hold the data (by default 60 sec)
-session
can not display data in Web URL.
How to create session:-
-all
session is to be created inside the event.
SYNTEX:-
Session[“Variable”]=control;
EX:-
Session[“Email”]=textbox1.text;
Note:-
-After
creating the session we have to used response.redirect statement.
How to access Session:-
-all
session is to be access inside the page load event .
SYNTEX:-
-control={string}session[“Variable”];
EX.:-
-textbox1.text=(string)session[“Email”];
HOW TO CREATE MULTIPLE SESSION:-
Session["Email"] = TextBox1.Text;
Session["Mobile"] = TextBox2.Text;
HOW TO CHECK SESSION IS NULL OR NOT:-
-in this
concept using Null statement with session Variable.
-this
process only used page load event .
HOW TO CLEAR SESSSION:-
-using
clear function.
Session.clear();
-Generally
used to log out button.
TASK
LOGIC:-
HOW TO
DISPLAY IMAGE IN IMAGE CONTROL :-
PAGE-1
-Put
image control and set the property of set URL.
-code
inside the button event
Session
[“pic”]=image1.imageURL
Response.redirectpage2
Page 2:-
Put
image control
Coding
inside page load.
Call the
session
DOUBT :-
-coding hamesha button mei hi hoti hai n ya fhir textbox
mei
-task1-db-date-time :- if wala concept kyu lagana hai n
-task-5-db-date- :- substraction ka result nhi aar rha
hai
-task radiobutton list control how to arrange 10
radiobutton and formation radiobutton task failed pls checked
-session task & admition assignment not be done some error in result
for uploading photo and label not result be done with code
-task multi view nahi hua kaise add karnege page usmei try kiya but hua nhi pura
-Session wala dt 27 june wala assignment wrong hua hai n
run bhi nahi ho raha hai.
QUERY
STRING :-
-query string is a state management concept.
-query string used to transfer data between one page to
other page.
-in query string transfer data is to be display on web URL.
-query string is representing (?) operator .
HOW TO
CREATE QUERY STRING :-
SYNTEX:-
Response.redirect(“page name.axps?variable=” +control);
//Create Query String
Response.Redirect("Q2.aspx?email="+TextBox1.Text);
HOW TO
ACCESS QUERY STRING:-
-query string is to be access inside the page load
event.
SYNTEX:-
Control=Request.QueryString[“Variable”];
//Create
Query String
Response.Redirect("Q2.aspx?email="+TextBox1.Text);
Label1.Text = Request.QueryString["email"];
HOW TO
CREATE MULTI VARIABLE QUERYSTRING :-
-in this types of concept create multiple variables in
querystring with the help of( &) operator.
Response.Redirect("Q2.aspx?email="+TextBox1.Text +
"&mobile=" +TextBox2.Text);
&&&
Label1.Text = Request.QueryString["email"];
Label2.Text = Request.QueryString["mobile"];
TASK :-
-convert
all session assignment into query string.
--------------------------------------------------------------------------------------------------
VIEW
STATE:-
** viewState:-
-
viewState is used to hold data in a single web
page
-
viewState can not transfer data between one page
to another page
** How To
create viewState:-
Syntax:
viewState[“variable”]
= control;
eg-
viewState[“email”]
= Textbox1.Text;
** How to
access viewState:-
Syntext:-
Control =viewstate[“variable”].tostring;
-viewstate cannot reserve any space inside computer memory.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial
class dataviewstate : System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
}
protected void
Button1_Click(object sender, EventArgs e)
{
// create
view state
ViewState["name"] = TextBox1.Text;
TextBox1.Text = "";
}
protected void
Button2_Click(object sender, EventArgs e)
{
// access
view state
Label1.Text = ViewState["name"].ToString();
}
}
}
COOKIES:-
-cookies is used to store pieces of information in web
browser.
-all data inside the cookies is stored limited time
duration.
HOW TO
CREATE A COOKIES:-
SYNTEX:-
Response.cookies [“variable”].value=control;
EX. :-
Response.cookies[“name”].value=textbox1.text;
HOW TO
EXPIRED COOKIES :-
SYNTEX:-
-response.coolkies[“variable”].expires=datetime.now.addminutes(value);
EX:-
responce.cookies[“name”].expires=datetime.now.addminutes(1);
HOW TO
CHECK COOKIES IS NULL OR NOT:-
SYNTEX:-
If(request.cookies(“variable”) == null)
{
}
EXAMPLE:-
If(request.cookies(“name”) == null)
{
}
HOW TO
ACCESS COOKIES :-
-SYNTEX:-
Control=request.cookies[“variables”].value;
EX.:
Label1.text=request.cookies[“naem”].value;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial
class DATACOOKIES : System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
}
protected void
Button1_Click(object sender, EventArgs e)
{
// Create
Cookies
Response.Cookies["name"].Value=TextBox1.Text;
// Expired
cookies
Response.Cookies["name"].Expires = DateTime.Now.AddMinutes(1);
Label1.Text = "Cookies created";
TextBox1.Text = "";
}
protected void
Button2_Click(object sender, EventArgs e)
{
// Check
the Cookies
if
(Request.Cookies["name"]==null)
{
TextBox2.Text = "Cookies Expired";
}
else
{
TextBox2.Text = Request.Cookies["name"].Value;
}
}
}
}
DOUBT :-
-coding hamesha button mei hi hoti hai n ya fhir textbox
mei
-task1-db-date-time :- if wala concept kyu lagana hai n
-task-5-db-date- :- substraction ka result nhi aar rha
hai
-task radiobutton list control how to arrange 10
radiobutton and formation radiobutton task failed pls checked
-session task & admition assignment not be done some error in result
for uploading photo and label not result be done with code
-task multi view nahi hua kaise add karnege page usmei
FILE
UPLOAD CONTROL :-
-in this type of control is used to uploading any types of
documents in web application.
//FILE UPLOAD CODING
FileUpload1.SaveAs(Server.MapPath("~") +
"//upload//" + FileUpload1.FileName);
Save as :- representing folder property.
~ :- is used to read root folder.
File upload1.file name :- display the name of file.
Server.mappath :- reprenting the path of your
folder(upload)
SYNTEX :-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial
class DATA_UPLOAD : System.Web.UI.Page
{
protected void
Page_Load(object sender, EventArgs e)
{
}
protected void
Button1_Click(object sender, EventArgs e)
{
//FILE
UPLOAD CODING
FileUpload1.SaveAs(Server.MapPath("~") +
"//upload//" + FileUpload1.FileName);
//display
image in image control
Image1.ImageUrl = "~/upload/" + FileUpload1.FileName;
//display
image name in label control
Label1.Text = FileUpload1.FileName;
}
}
}
** How to use html control in .net framework:-
-In this concept using HTML
control inside aspx page
-Create HTML control using <input>
-<input type ="text" id="t1">
** Convert HTML control to .net control:
-In this concept using runnet
attribute in html control
-<input type ="text" id="t1"
runat="server">
** How to access html control in c#:-
***MASTER
PAGE:-
-
master page is common to all website.
-
The Extention of master page DOTmaster
-
Master page cannot executed directly
-
Master page is to be executed with ASPX page.
-
Master page cannot run directly
-
Master page is to be executed with ASPX page.
HOW TO
CREATE MASTER PAGE:-
-
STEPS :-
Go to solution explorer -> add new item
-> search master page -> select web form master page -> name of master
page ->
ELEMENT
OF MASTER PAGE :-
-
There are
following element used in master page
1.
HEADER
2.
FOOTER
3.
CONTAINT PLACE FOLDER (always blank)
4.
MENU
HOW TO
CONNECT ASPX PAGE TO MASTER PAGE:-
-
STEPS :-
-
Go to solution explorer -> add new item ->
search web form master page -> name of ASPX page -> Than ADD ->
connect with MASTER page.
---------------------------------------------------------------------------------------------------------------------------
VALIDATION
:-
-
Validation Is a process for accepting correct
data only
-
There are two types of validation used in DOT
NET framework.
1.
Clint side validation (Java Script)
2.
Server side validation (DOT net Control)
1)
SERVER SIDE CONTROL :-
-
There are following control used in server side
validation.
1.
RequiredFilledValidator
2.
RangeValidator
3.
RegularExpression
4.
CompareValidator
5.
ValidationSummary
NOTE:-
- all types of validation control is to be
configure in Dot Net framework using Web configration file.
- configure dot net
validation control is used to <app> setting tag.
<appSettings> <add
key="ValidationSettings:UnobtrusiveValidationMode"
value="None" /> </appSettings>
PROPERTY
OF REQUIREDFILLEDVALIDTOR :-
-
ErrorMassage
-
ControlToValid
PROPERTY
OF RANGE VALIDTOR :-
-
ErrorMassage
-
ControlToValid
-
MinValue
-
MaximumValue
REGULAR
EXPRESSION CONTROL :-
-
Regular expression control IS check regularity
of data
-
This control generally is used to mobile number validation, email
validation etc,
PROPERTY
:-
-
ErrorMassage
-
ControlToValid
-
ValidationExpression \d{10}
COMPARE
VALIDATION :-
PROPERTY
:-
-
ErrorMassage
-
ControlToValid
-
ControlToCompare
VALIDATION
SUMMARY :-
-
Validation
summary is use to display all error massage at the time of validation
-
Validation
summary always display automatic data.
PROPERTY:-
-
Only button
-
And automatic detected.
NOTE :-
-
Required filed validator open tag and close tag
< > </> iske bitch mei * lagana jaruri hai.
-
<> * </>
__________________________________________________________________________________
***MASTER
PAGE:-
-
master page is common to all website.
-
The Extention of master page DOTmaster
-
Master page cannot executed directly
-
Master page is to be executed with ASPX page.
-
Master page cannot run directly
-
Master page is to be executed with ASPX page.
HOW TO
CREATE MASTER PAGE:-
-
STEPS :-
Go to solution explorer -> add new item
-> search master page -> select web form master page -> name of master
page ->
ELEMENT
OF MASTER PAGE :-
-
There are
following element used in master page
5.
HEADER
6.
FOOTER
7.
CONTAINT PLACE FOLDER (always blank)
8.
MENU
HOW TO
CONNECT ASPX PAGE TO MASTER PAGE:-
-
STEPS :-
-
Go to solution explorer -> add new item ->
search web form master page -> name of ASPX page -> Than ADD ->
connect with MASTER page.
---------------------------------------------------------------------------------------------------------------------------
VALIDATION
:-
-
Validation Is a process for accepting correct
data only
-
There are two types of validation used in DOT
NET framework.
3.
Clint side validation (Java Script)
4.
Server side validation (DOT net Control)
2)
SERVER SIDE CONTROL :-
-
There are following control used in server side
validation.
6.
RequiredFilledValidator
7.
RangeValidator
8.
RegularExpression
9.
CompareValidator
10.
ValidationSummary
NOTE:-
- all types of validation control is to be
configure in Dot Net framework using Web configration file.
- configure dot net
validation control is used to <app> setting tag.
<appSettings> <add
key="ValidationSettings:UnobtrusiveValidationMode"
value="None" /> </appSettings>
PROPERTY
OF REQUIREDFILLEDVALIDTOR :-
-
ErrorMassage
-
ControlToValid
PROPERTY
OF RANGE VALIDTOR :-
-
ErrorMassage
-
ControlToValid
-
MinValue
-
MaximumValue
REGULAR
EXPRESSION CONTROL :-
-
Regular expression control IS check regularity
of data
-
This control generally is used to mobile number validation, email
validation etc,
PROPERTY
:-
-
ErrorMassage
-
ControlToValid
-
ValidationExpression \d{10}
COMPARE
VALIDATION :-
PROPERTY
:-
-
ErrorMassage
-
ControlToValid
-
ControlToCompare
VALIDATION
SUMMARY :-
-
Validation
summary is use to display all error massage at the time of validation
-
Validation
summary always display automatic data.
PROPERTY:-
-
Only button
-
And automatic detected.
NOTE :-
-
Required filed validator open tag and close tag
< > </> iske bitch mei * lagana jaruri hai.
-
<> * </>
-----------------------------------MASTER
PAGE CREATING FOR THE ONLINE STUDENT COMPLAINED HANDLING SYSYTEM ASSIGNMENT
STEP BY STEP EXPLANATION-------------------------------------
CREATE NORAML MASTER PAGE THAN HOW TO FIXED DESIGN :-
GO TO source-> <div> </div> copy and paste
(jitne line chahiye utne copy kar skate ho)-> than click any header as per
your requiremet than add menu and drag to the header -> right click arrow
-> add heading as per req -> than properties fixed -> 1 orientation –
vertical / horizontal asper req -> 2 redering mode à table -> than 3 stattic
item menu style -> arrow click than
back color -> add color -> horizontal padding -> for space 20,
30 ex->
HEADER1 :- NORAMAL text add-> than properties -> 1style changes some
border ->
Connect to aspx page using
:- MasterPageFile="~/collegeadmin.Master"
MASTER PAGE BY NILESH SIR :-
-
Root pe right click -> add-> new ->
search master -> select [] web forms master page -> add page->
-
Automatic open page-> go to source -> <div> </div>
tag delete -> than design ADD( MANUALLY DATA ) -> Than toolbox search
link add link-> properties change give them name -> than add content
place holder-> create aspx page (note
:- all design automatically show in aspx page)
-
Create aspx page and link:- add->new->search master -> 0 wala
web forms master page select -> add name-> connect with master page ->
add
-NOTE:- (ADD PAGESG IN LINK BUTTON):-
- click on link button(name change kiya
hua)->properties-> post back url -> … select page name and click add.
NOTE:- BAKI jo bhi coding karna hai like textbox, button and
etc woh content place holder ke ander karna hai
DATA BASE :-
DATE:-13/8/2025 & 15/11/2025
DATA BASE:-
-
Data base is collection of antity.(Table)
-
All data base related activity used in server
explorer window
-
In dot. Net framwork support SQL server
management studio
-
The Extention of SQL server is (.mdf) - Microsoft
data file
-
There are two types of method is used to work
data base environment in dot net Framwork
1.
Connect structure
2.
Disconnect structure
HOW TO CREATE DATA BASE IN DOT NET FRAMWORK :-
STEPS:-
Go to solution explorer -> of the root -> add ->
new item-> search sql -> select sql server data base option -> name of
data base (.mdf) -> add
NOTE:-
all data base location in app data folder in
dot net (dot net framwork).
HOW TO ACTIVATE DATA BASE ENVIRONMENT :-
-
Data base environment is to be activated using
server explorer window.
Data base is collection of NTT(table)
Ex. College database
Student – roll,
name, city
Faculty- name,
designation, subject
TYPES OF
DATA BASE:-
THERE ARE TWO TYPES OF DATA BASE :-
1.LOCAL DATA BASE
2.GLOBAL DATA BASE (Web database)
EXTENTION
OF DATA BASE:-
SQL =.mdf
XML= .xml
DATA BASE STRUCTURE :-
- data base structure is represent table format.
Roll name city
101 mahesh Nagpur
DATA BASE TERMINOLOGY:-
-there are following terms used in data base.
1 data base field
1
data base record
- all types of data in a data base is called record
2
data base tuple
3
data base query
1
data base field
roll name city Is called field.
= ex . roll
name city
101 rahul
Nagpur
102 MAHESh
nashik
2
data base record
all types of data in a data base is called
record
-types of
field :-
1.Single value field
2.multivalue filed
3.null field
1.Single
value field
= in this types of field only store one data value
Ex. Roll no , Aadhar
number, ETC
2.multivalue filed
=in this types of field used multiple data record
Ex. Address (office address, recidence address)
3.null
field
=in this types cannot required compulsory data
Ex. Mobile number, pan card, Etc
3.DATA
BASE TUPPLE:-
-complete data base called tupple.
4.DATA
BASE QUERY :--
-query is representing command.
C# and development
DATA BASE
DATA TYPE :-
Following
data type used in data type.
1. Numerical INT
2. VARCHAR -accept value character or
symbol
3. ANDVARCHAR -accept number &
character
4. Date – accept date
5. Image
HOW TO CREATE DATA BASE :-
Right click of data base à new data base à name of data base à ok à
DATA BASE
QUERY :-
-
Query is set of command is used to apply data
base environment
-
All types of query is performed (query editor
window)
-
Query editor window is used only server explorer
window
STEPS :-
DOUBLE CLICK ON data
base -> go to server explorer ->
right click on table folder -> and select new query option
HOW TO
ADD NEW QUERY :-
STEPS :-
SELECT YOUR DATA BASE NAME à
click new query option à
HOW TO
CREATE NEW TABLE :-
SYNTEX:-
CREATA TABLE NAME(Column datatype)
CREATE TABLE STUDENT(Roll int, name varchar(50));
HOW TO
DISPLAY TABLE STRUCTURE :-
SYNTEX:-
SP_HELP STUDENT;
HOW TO
CREATE INSERT QUERY :-
-there are three specific pattern used in insert query.
1. INSERT
ALL RECORDS
INSERT INTO
TABLENAME VALUE (DATA )
NOTE:- -All data string data value used (‘ ’)
INSERT INTO STUDENT VALUES(101,'MAHESH');
INSERT INTO STUDENT VALUES (102,'RAHUL')
INSERT INTO STUDENT VALUES(103,'MEHUL')
INSERT INTO STUDENT VALUES(104,'AASHU')
INSERT INTO STUDENT VALUES(105,'ABHI')
2.INSERT
PARTICULAR RECORD
INSERT INTO
TABELNAME(COLUMN ) VALUES(DATA )
3.INLINE
INSERT :-
Syntex:-
INSERT INTO TABLENAME VALUES(DATA),(DATA),(DATA)----
INSERT INTO STUDENT
VALUES(101,'ABHI'),(102,'MEHUL'),(104,'MAHESH')
HOW TO
DISPLAY DATA RECORDS:-
-there are some following methods is used to display data
record.
1.
DISPLAY ALL RECORDS
Syntex:-
SELECT*FROM TABLENAME
SELECT*FROM STUDENT
2.DISPLAY
PARTICULAR
SYNTEX:-
SELECT COLUMN NAME FROM TABLENAME
SELECT NAME FROM STUDENT
3.DISPLAY
WITH CONDITION
-in this concept using data base clauses
1. WHERE CLUASE
2.BETWEEN CLUASE
3.GROUP BY
4. ORDERD BY
5. INCLAUSE
6. EXIST CLUASE
TASK:-
CREATE A TABLE EMPLOYEE (ID,NAME,city ,state, country,
salary )
Insert any `10 records with all operation and perform select
operation
ANS:-
SELECT * FROM employee
CREATE TABLE employee(id INT,name VARCHAR(50),city
VARCHAR(50),salary int(50),state VARCHAR(50),country VARCHAR(50));
INSERT INTO employee
VALUES(111,'one','nagpur',5000,maharastra,India);
INSERT INTO employee
VALUES(112,'two','pune',6000,haryana,india);
INSERT INTO employee
VALUES(113,'three','nashik',7000,uttarpradesh,india);
INSERT INTO employee
VALUES(114,'four','amravati',8000,bihar,india);
INSERT INTO employee
VALUES(115,'five','wardha',9000,ladakh,india);
INSERT INTO employee
VALUES(116,'six','dhule',10000,jammukashmir,india);
INSERT INTO employee
VALUES(117,'seven','mumbai',11000,jharkhand,india);
INSERT INTO employee
VALUES(118,'eight','baramati',12000,madhyapradesh,india);
INSERT INTO employee
VALUES(119,'nine','malegao',13000,telgana,india);
INSERT INTO employee
VALUES(120,'ten','chandrapur',14000,punjab,india);
SELECT * FROM employee WHERE name='two';
SELECT* FROM employee WHERE id BETWEEN 112 AND 119;
SELECT* FROM employee WHERE salary > 10000;
SELECT* FROM employee WHERE id=120;
SELECT* FROM employee WHERE city='baramati';
SELECT* FROM employee WHERE salary<6000;
DATA BASE
QUERY :-
-
Query is set of command is used to perform
specific action in a data base table there are following queryies is used to
data base.
1.
CREATE TABLE QUERY
2.
INSERT QUERY
3.
UPDATE QUERY
4.
DELETE QUERY
5.
SELECT QUERY
1 CREATE
TABLE QUERY :-
In this query used to create intity in a
data base
SYNTEX:-
Create table name(columnname datatype)
Ex. Create table student(roll
int, name VARCHAR(50))
CREATE TABLE STUDENT(ROLL INT, NAME
VARCHAR(50))
INSERT RECORDS:-
- there are following pattern is used to insert record in data base.
1.
INSERT ALL RECORDS
2.
INSERT PARTICULAR RECORDS
3.
INLINE INSERT
4
INSERT ALL RECORDS :-
SYNTEX:-
Insert Into Name Values(Data)
EX.
INSERT INTO STUDENT VALUES(101,'RAHUL')
INSERT INTO STUDENT VALUES(102,'MAHESH')
INSERT INTO STUDENT VALUES(103,'KARAN')
2 INSERT PARTICULAR RECORDS :-
-
IN This concept used to insert records in a
particular column.
SYNTEX. :-
Insert Into Name(Column name )Values(Data);
EX. INSERT INTO STUDENT(NAME)VALUES('RAHUL');
3 INLINE INSERT :-
-
IN This concept user can insert data records
with the help of single line method.
SYNTEX:-
EX.
INSERT INTO STUDENT
VALUES(201,'RAHUL'),(301,'MAHESH'),(401,'KARAN');
HOW TO
DISPLAY DATA RECORD:-
-Display data record in table using select
command.
SYNTEX:-
SELECT * FROM STUDENT;
Display
record with condition :-
– This concept using database clause
- There
are following database clause.
-
1.
Where clause – Using condition
-
2. Between Clause – Set the range of data.
-
3. Order by clause – Arrange of Records
-
4. Group by clause – Group of similar Data
-
5. Having Clause – Using SQL functions
-
6. IN Clause – Search the multiple Strings.
1.Where Clause :-
SYNTEX
:-
SELECT * FROM Student WHERE Roll=101;
SELECT * FROM STUDENT WHERE roll=101;
2.DISPLAY
RECORDS WITH MULTIPLE CONDITIONS :-
SYNTEX:-
SELECT * FROM STUDENT WHERE ROLL=101 AND NAME='RAHUL';
3.BETWEEN
CLAUSE (SET THE RANGE):-
SYNTEX :-
SELECT * FROM STUDENT WHERE ROLL BETWEEN 102 AND 103;
4.GROUP
BY CLAUSE :-
-Display repeeted data value at once.
SYNTEX:-
SELECT NAME FROM STUDENT GROUP BY NAME;
5.ORDER
BY CLAUSE :-
-arrange data record (ascending or descending order )
Ascending order- ASC
Descending order- DESC
SYNTEX :-
SELECT * FROM STUDENT ORDER BY ROLL ASC;
SELECT * FROM STUDENT ORDER BY ROLL DESC;
6.IN
CLAUSE :-
-This clause is used to multiple search fundamental
SYNTEX:-
SELECT * FROM STUDENT WHERE NAME IN ('RAHUL','KARAN');
UPDATE
QUERY :-
-this query is used to modify table record
SYNTEX:-
UPDATE TABLE NAME SET COLUMN NAME =VALUE WHERE CONDITION
UPDATE STUDENT SET NAME='MOHAN' WHERE ROLL=101;
DELETE
QUERY :- (REMOVE RECORD)
SYNTEX:-
DELETE FROM TABLE NAME WHERE
DELETE FROM STUDENT WHERE ROLL=101;
ALL KEYS
:-
SELECT* FROM student
SELECT * FROM STUDENT WHERE roll=101;
SELECT * FROM STUDENT WHERE ROLL=101 AND NAME='RAHUL';
SELECT * FROM STUDENT WHERE ROLL BETWEEN 102 AND 103;
SELECT NAME FROM STUDENT GROUP BY NAME;
SELECT * FROM STUDENT ORDER BY ROLL ASC;
SELECT * FROM STUDENT ORDER BY ROLL DESC;
SELECT * FROM STUDENT WHERE NAME IN ('RAHUL','KARAN');
DELETE FROM STUDENT WHERE ROLL=101;
UPDATE STUDENT SET NAME='MOHAN' WHERE ROLL=101;
TASK 1:-
CREATE A TABLE MARKSEET
COLUMN NAME – ROLL, NAME, CITY ,COLLEGE, MARK1,MARK2,MARK3,MARK4,MARK5
, TOTAL , GRADE
LOGIC-
1.
INSERT 10 RECORD
2.
EXCLUDE TOTAL AND GRADE COLUMN (RECORD INSERT
NAHI KARNA HAI)
3.
DISPLAY TABLE STRUCTURE
4.
UPDATE TOTAL COLUMN (FORMULA -)
TOTAL =
5.
UPDATE GRADE COLUMN IN FOLLOWING CONDITION
TOTAL > 250 à A GRADE
TOTAL>150<250 à B GRADE OTHERWISE FAILED.
6.
UPDATE NAME OF MARKSHEET (MUKESH WHERE ROLL NO.
IS 101)
7.
DELETE RECORD FOR MARKSHEEET WHERE ROLL NO IS
101
8.
DISPLAY ALL RECORDS FOR MARKSHEET TABLE
WHERE CITY IS NAGPUR,MUMBAI
9.
PERFORM GROUP BY CLUASE IN MARKSEET TABLE
10.
DISPLAY ALL RECORD FOR MARKSHEET TABLE WHERE
TOTAL BETWEEN (280 TO 300)
11.
CREATE ANY ONE QUERY IN MARKSHEET TABLE IN YOUR
OWN IDEAS(EXCLUDE ASSIGNMENT QUERY)
HOW TO
DISPLAY TABLE STRUCTURE :-
SYNTEX :_
SP_HELP STUDENT;
DATA BASE
ALIAS :-
-ALIAS is used to provide virtual heading of any column.
-data base ALIAS is used to AS keyword.
SYNTEX:-
SELECT NAME AS FIRST_NAME FROM STUDENT;
UPDATE
QUERY :-
-update query is used to
SYNTEX:-
Update tablename SET COLUMNNAME = value where condition;
CREATE TABLE STUDENT(ID INT, NAME VARCHAR(50));
INSERT INTO STUDENT VALUES(101,'XYZ')
INSERT INTO STUDENT VALUES(102,'ABC')
SELECT* FROM STUDENT
UPDATE STUDENT SET NAME='RAMESH' WHERE ID=101;
UPDATE STUDENT SET NAME='AMIT' WHERE ID=102;
DELETE
QUERY :-
-ONLY delete data base record.
SYNTEX:-
Delete from tablename
where condition
DELETE FROM STUDENT WHERE ID=101
IN CLUASE
:-
-IN clause basically used to search multiple string in data
base
SYNTEX:-
INSERT INTO STUDENT VALUES (108, 'AMIT');
INSERT INTO STUDENT VALUES (109,'SUMIT');
INSERT INTO STUDENT VALUES (103,'RAHUL');
SELECT * FROM STUDENT WHERE NAME IN ('AMIT','SUMIT');
DATA BASE
TOP QUERY :-
-TOP query is used to display any top records in data base
table
SYNTEX:-
SELECT TOP 2 * FROM STUDENT;
BETWEEN
CLAUSE:-
-Between clause is used to display data value in specific
range
Que- display all record from student where roll between 103
to 108.
SYNTEX:-
SELECT * FROM STUDENT WHERE ID BETWEEN 103 AND 108;
ALL QUERY
:-
CREATE TABLE STUDENT(ID INT, NAME VARCHAR(50));
INSERT INTO STUDENT VALUES(101,'XYZ')
INSERT INTO STUDENT VALUES(102,'ABC')
SELECT* FROM STUDENT
UPDATE STUDENT SET NAME='RAMESH' WHERE ID=101;
UPDATE STUDENT SET NAME='AMIT' WHERE ID=102;
DELETE FROM STUDENT WHERE ID=101
INSERT INTO STUDENT VALUES (108, 'AMIT');
INSERT INTO STUDENT VALUES (109,'SUMIT');
INSERT INTO STUDENT VALUES (103,'RAHUL');
SELECT * FROM STUDENT WHERE NAME IN ('AMIT','SUMIT');
SELECT TOP 2 * FROM STUDENT;
SELECT * FROM STUDENT WHERE ID BETWEEN 103 AND 108;
REVISED BASIC QUERY.
-create table query
-insert
-update
-delete
-select
Date :- 12/9/2025
DATA BASE CLAUSE:-
-is used to provide condition in data base record .
-there are following clause used in data base
1.WHERE CLAUSE
2.BETWEEN CLAUSE
3.ORDER BY CLAUSE
4.GROUP BY CLUASE
5.IN CLAUSE
6.EXIST CLAUSE
7.HAVING CLAUSE
1. WHERE CLUASE :-
-
In this clause is used to check the condition in
the table.
-
Display all record from a student where roll no.
is 101.
SELECT * FROM student WHERE roll=101;
-
Display all record for a student where roll no.
is 101 and name is amit.
SELECT * FROM student WHERE roll=101 AND
name='amit';
2. BETWEEN CLAUSE :-
-
Between clause basically used to display data
record in specific range
Que. Display
all record for student where roll between 102 to 104.
--- SELECT * FROM student WHERE roll BETWEEN
102 AND 10
TASK 1:-
CREATE A TABLE EMPLYEE
Column name id , name, city, salary , HRA ,
DA
Insert any 10 record
Generate 10 query using where clause and
between clause .
________ ]
________ ] ANS :-
SELECT * FROM employee
CREATE TABLE employee(id INT,name
VARCHAR(50),city VARCHAR(50),salary VARCHAR(50),HRA VARCHAR(50),DA
VARCHAR(50));
INSERT INTO employee
VALUES(11,'one','nagpur',5000,1000,500);
INSERT INTO employee
VALUES(12,'two','pune',6000,1100,600);
INSERT INTO employee
VALUES(13,'three','nashik',7000,1200,700);
INSERT INTO employee
VALUES(14,'four','amravati',8000,1300,800);
INSERT INTO employee
VALUES(15,'five','wardha',9000,1400,900);
INSERT INTO employee
VALUES(16,'six','dhule',10000,1500,1000);
INSERT INTO employee
VALUES(17,'seven','mumbai',11000,1600,1100);
INSERT INTO employee
VALUES(18,'eight','baramati',12000,1700,1200);
INSERT INTO employee
VALUES(19,'nine','malegao',13000,1800,1300);
INSERT INTO employee
VALUES(20,'ten','chandrapur',14000,1900,1400);
SELECT * FROM employee WHERE name='two';
SELECT* FROM employee WHERE id BETWEEN 12
AND 19;
SELECT* FROM employee WHERE salary >
10000;
SELECT* FROM employee WHERE id=20;
SELECT* FROM employee WHERE
city='baramati';
SELECT* FROM employee WHERE DA BETWEEN 1000
AND 1300;
SELECT* FROM employee WHERE salary<6000;
SELECT* FROM employee WHERE city= 'nashik';
SELECT* FROM employee WHERE da>1200 AND
salary < 13000;
SELECT* FROM employee WHERE salary>6000
AND salary < 13000;
ALL KEYS :-
CREATE TABLE student(roll INT,name VARCHAR(50));
INSERT INTO student VALUES(101,'amit');
INSERT INTO student VALUES(102,'rahul');
INSERT INTO student VALUES(103,'rushi');
INSERT INTO student VALUES(104,'tejas');
INSERT INTO student VALUES(105,'mahesh');
SELECT * FROM student
SELECT * FROM student WHERE roll=101;
SELECT * FROM student WHERE roll=101 AND name='amit';
SELECT * FROM student WHERE roll BETWEEN 102 AND 104;
BALANCE
TOPIC :-
-
How to create autogenerate coloumn
1.
Autogenerate coloumn – Is automatically
increament data value.
CREATE TABLE Demo5 (id INT IDENTITY(1,1),name VARCHAR(50));
Note: Identity coloumn can not used insert Query.
-
How to perform insert identity in coloumn
identity.
-
CREATE TABLE Demo5 (id INT IDENTITY(1,1),name
VARCHAR(50));
-
-
INSERT INTO Demo5 (name)VALUES('Nagpur');
-
INSERT INTO Demo5 (name) VALUES('Delhi');
-
INSERT INTO Demo5 (name) VALUES('Mumbai');
-
-
SELECT * FROM Demo5
-
-
How to reset the identity table
-
CREATE TABLE Demo5 (id INT IDENTITY(1,1),name
VARCHAR(50));
-
-
INSERT INTO Demo5 (name)VALUES('Nagpur');
-
INSERT INTO Demo5 (name) VALUES('Delhi');
-
INSERT INTO Demo5 (name) VALUES('Mumbai');
-
-
SELECT * FROM Demo5
-
-
DELETE FROM Demo5
-
TRUNCATE TABLE Demo5;
-
Database view (v.imp)-
-
view is called virtual table.
-
Virtual table is used to store data or
information in a virtual table.
-
View can’t reflect your original table.
-
There are following operation for performing in
a view.
1.
Create view
2.
Update view
3.
Delete view
4.
Display view
-
CREATE VIEW - CREATE VIEW my1 AS SELECT * FROM
Demo5;
-
Display view - SELECT * FROM my1;
-
Modify view - ALTER VIEW my1 AS SELECT * FROM
Demo5 WHERE id=1;
-
Delete view - DROP VIEW my1;
LAPTOP-KTNGB4Q7\SQLEXPRESS01
DATA BASE :- SQL
create table student(roll int, name varchar(50))
insert into student values(101,'mahesh');
insert into student values(102,'rahul');
select* from student;
sp_help student
select * from student where roll=101
select name from student
select name as student_name from student
select name, roll from student
select roll from student group by roll
select top 1 * from student
SELECT*FROM Captain
CREATE TABLE CAPTAIN(id int,name varchar(50),city
varchar(50),state varchar(50),country varchar(50),salary int (50));
INSERT INTO CAPTAIN
VALUES(111,'MAHESH','NAGPUR','MAHARASTRA','INDIA',5000);
INSERT INTO CAPTAIN
VALUES(112,'RAHUL','MUMBAI','HARYANA','INDIA',7000);
INSERT INTO CAPTAIN
VALUES(113,'KARAN','BHOPAL','MADHYAPRADESH','INDIA',9000);
INSERT INTO CAPTAIN
VALUES(114,'MEHUL','PATNA','BIHAR','INDIA',10000);
INSERT INTO CAPTAIN
VALUES(115,'ABHISHEK','SHREENAGAR','JAMMU','INDIA');
Comments
Post a Comment