Navigation in Asp.net
This article explains how to do navigation in Asp.net
##Basic Info before studying further
#Switch - single expression, multiple output
#If then else -
multiple expression, multiple output
# File > New project> Language C#
Website > browse >“give any name” > save and ok
Click on website > Add> New item > webform
View> Solution Explorer
#How to create Starup page
Goto Solution Explorer>Right click on page> set as start
up page
#How to navigate
//Response.Redirect
//Server.Transfer
//Server.Execute
* Server.Transfer only works with
aspx pages not html
* Response.Redirect works with both
pages
* Server.Transfer only works with
internal url not external url
* Response.Redirect works with both
url
* Server.Transfer – for security
reason url remain same. Only works with internet.
* Response.Redirect – here it
changes
* Server.Transfer is better than
Response.Redirect in performance
* Server.Execute only execute not
display
# Click on Default.aspx
In Toolbox > Standard >
Button
In Toolbox > Standard > Hyperlink
#Now Double Click on Button
protected void Button1_Click(object sender,
EventArgs e)
{
Response.Redirect("default.aspx");
}
}
|
# Now Right click on Hyperlink
Navigate url: default2.aspx
# Double click on Default page,
then right click >Break point> Insert Breakpoint
# So that page will not scroll
<%Page.MaintainScrollPositionOnPostBack="true"
|
# Database Handling
* Database – There are 2 types
1. File Server Database
2. Client Server Database
* File Server Database – Its for single user application. At a
time single user operates. Ex – notepad, MS Access
* Client Server Database- Its for multi user application. Ex –
MS SQL, Oracle, MY SQL
Client Server – MSSQL SERVER
MSSQL SERVER – CLR (Compatible + Better Performance)
# Database
SQL-
Structure Query Language – It is base language for all databases. It is non-
procedural language[Procedure language cannot be made]. It is simple English
language.
T-SQL –
Transact SQL
1.
Triggers
2.
Stored procedure
3.
Functions
4.
Indexes
5.
Views
6.
Cursors
clr is inbuilt in SQL
#Different Editions
of SQL
* MSSQL SERVER – SQL
EXPRESS -7.5,2000, 2005, 2008(for student only)
* MSSQL SERVER DEV –
paid / canbe used in companies
* MSSQL SERVER STD
–used in big companies
* MSSQL SERVER ENT –
for secured db
# Which types of
files or extensions are in MSSQL
.mdf - Primary file
.ldf – Log file
.ndf – Secondary
File
.sdf- Mobile
database
# Role of these
files
.mdf – For 1
database ,1 file is made. Max size – 8 gb (for express version).There is only
one Primary file.
.ldf – [log
file/transaction log file]- if .mdf file is corroupted then data can be
recovered from it.
.ndf – When file
size of primary is increased then secondary file will be made. Use defined
file. Secondary file can be multiple.
.sdf – It is compact
file. There is only single file. For mobile applications.
# How to create
database
Click on View> Server
Explorer(Open Vs)
* Server explorer –
to manage database
Application server –
for asp.net application (It runs on this server)
Database server –
For database application
Server >
DESKTOP-I3R20OL(it will different for every user)
Instance name(to
differentiate or to access) - SQLEXPRESS
Ø Right click
on Data connection> Create New SQL Server database
Ø Server name
- DESKTOP-I3R20OL\SQLEXPRESS (will be according to user pc or laptop)
Ø Windows
Authentication – can access windows user
Ø New
database name – dbemployee(can be any)
Dataconnection>desktop-i3r20ol\sqlexpress.dbemployee.dbo
Select your database> Right Click on Table > Add New table
Change table name – employee
# Types of integers in MSSQL SERVER
1.
Tiny int – 1 bytes =0-255 integer
2.
Small int – 2 bytes
3.
Int – 4 Bytes
4.
Big int – 8 bytes
* Datatype – int (acc to capacity or required by client)
* Emp no. should not be duplicate for that
Constrain (validation check)– primary key
*Primary key
Ø To be used
for not null and unique
Ø Multiple
primary key cannot be made
Ø When
primary is made, index is applied to it
*Index – To retrieve data fast
# Which Index is applied
*Cluster index- for primary key, one table, one cluster index
*Non- cluster index- one table upto 249 clusters
# Primary key v/s Unique
Primary
key
|
Unique
|
One
table, one key
|
One
table, multiple unique
|
It
is not null and unique
|
It
is unique and null can come but only once
|
# Table
Emp no.
Ename
*String data – varchar type
Varchar- 8000 characters can be stored
Varchar(Max)- 2gb
Nvarchar- 4000(Multilanguage)
Nvarchar(max)- 2gb
# Data type
*CHAR – Fixed length(same memory for storing one or more characters)
*VARCHAR- To store non-unique code value
*NVARCHAR- Store unique code value
*VARCHAR- It takes 1 or 3 bytes extra
*CHAR- It is fixed
*VARCHAR= 0-255 – then 1 byte extra
=
>255- 2 bytes extra
# Why extra bytes
When converging from 1 data type to other data type
#How many columns in one table
In MSSQL 2007
Sparse column – 30,000
Non- sparse column – 1024
*Sparse column- Used when value is maximum null. As it reduces
the size upto 40%
# In Table
Name
|
Data
Type
|
Allow
Null
|
empno
|
int
|
|
ename
|
Varchar(50)
|
Y
|
eadd
|
Varchar(50)
|
Y
|
esal
|
int
|
y
|
Click on update (top left corner) > update database
No comments:
Post a Comment