: WEB- . :
;
;
.
: Microsoft Visual Studio 2005 Web- , WEB-. :
"" :
( );
( );
( .)
:
.
:
Web- , . , Web- . , , .
Microsoft Visual Studio 2005 Web-, . , Microsoft Visual Studio 2005 , Microsoft SQL Server.
.
Microsoft Visual Studio 2005, , Database Explorer, .
, , , .
, Database Explorer. Visual Studio, Solution Explorer. (. .1)
1 Database Explorer
Solution Explorer Database Explorer, . Database Explorer, Database Explorer , Database Explorer View.
, :
1. Microsoft Visual Studio 2005, Web site Database Explorer;
2. Database Explorer Data Connections Add Connection ;
3. Add Connection, 2, Data Source , .
|
|
2 Add Connection
Data provider, , Change. Change Data Source (.3). , Data provider, Always use this selection. Change Data Source, OK.
3 Change Data Source
4. Add Connection, Data Source.
Data Source , ;
, Change 3.
Add Connection . , Data Source . Add Connection OK.
Microsoft Visual Studio 2005 Microsoft SQL Server. , :
Microsoft Access;
Oracle ( Oracle Microsoft );
, ODBC OLE-DB .
SQL , Add Connection:
1. Server Name, , , , SQL . , Server Name. , SQL .
, SQL , . , , (, STORM), SQLEXPRESS. , Server Name STORM\SQLEXPRESS.
2. SQL , :
Use Windows Authentification. , Microsoft Windows, SQL . , SQL .
Use SQL Server Authentification. SQL , SQL . , SQL , . , , SQL .
3. , .
SQL , Select or enter a database name.
4. .mdf SQL , :
. mdf Attach a database file. Browse, , Open.
|
|
Logical Name, , . SQL .
5. , Test Connection . , Microsoft Visual Studio 2005 "Test connection succeesed", .
6. OK, .
Database Explorer. .
:
(+), , , : Tables, Views, Stored Procedures .
(+), , . , (+) Tables, .
(+), , ...
, SQL : .mdf, .ldf. , SQL , :
, Web-, App_Data . .
, Web-, SQL . , C:\Program Files\Microsoft SQL Server\MSSQL.l\MSSQL\Data
SQL .mdf, App_Data.
Web-, :
Web-;
New File File;
Add New Item, SQL Database;
Name, .mdf
Add. (.4), Yes. Microsoft Visual Studio 2005
4 , App_Data
, Microsoft Visual Studio 2005 , , . , "" "", :
1. Database Explorer, (+) , . Tables, Add New Table .
2. Microsoft Visual Studio 2005 Table1 . .
, :
Table Designer , Column Name;
id_ Tab;
Data Type, Int Tab;
Allow Nulls;
Column Properties , Identity Specification, (+), , Yes Is Identity (.5);
id_ Set Primary Key
|
|
5
Yes Is Identity id_ SQL , . , , Set Primary Key , SQL .
3. , , , . , , (.1)
1 ""
Column name | Data Type | Allow Nulls | Identity | Primary Key |
id_ | int | Unchecked | ||
nvarchar(60) | Checked | |||
[ ] | smalldatetime | Unchecked | ||
nvarchar(15) | Checked | |||
[ ] | nvarchar(50) | Checked | ||
smallmoney | Checked | |||
int | Unchecked |
4. Save Tablen File, n , Microsoft Visual Studio 2005 . Choose Name (.6), , , " ", OK.
6
, , Database Explorer Open Table Definition . (.5).
, Database Explorer Delete. , , .
, , Database Explorer Show Table Data . Query Designer, . 7, Query Designer : Results, SQL, Criteria, Diagram
7
Query Designer , Results, , , :
, .
, .
, Del.
Microsoft Visual Studio 2005 , , ENTER, Del . .
, , Results . , Query Designer. , :
Query Designer, Pane .
, . , :
|
|
Diagram , . , , AZ .
( ) Database Explorer Diagram.
( , , ) .
, , , , .
Criteria , . SQL SQL , .
, Query Designer: SQL, Criteria Diagram, Microsoft Visual Studio 2005 . , , SQL, Visual Studio 2005 Diagram Criteria .
Results . , , Show Table Data, : SELECT * FROM < >
Diagram, Criteria SQL, , Results , :
Execute SQL Query Designer,
Query Designer, Execute SQL .
Microsoft Visual Studio 2005 Web- . . App_Data. Microsoft Visual Studio 2005 , .
Web- Microsoft Visual Studio 2005 :
Data Connection, .
Data Source Data Connection , , , .
Data Bound Controls , Data Source.
Microsoft Visual Studio 2005, :
Database Explorer, Data Connection , Web-.
Web- . Database Explorer (.8), Web-: SqIDataSource GridView . GridView . Microsoft Visual Studio 2005 GridView .
8 GridView
, SqlDataSource Toolbox's Data . .2 .
2
SqIDataSource | Microsoft SQL . |
AccessDataSource | Microsoft Access. |
ObjectDataSource | . |
XmlDataSource | , XML . |
SiteMapDataSource | , . |
Database Explorer, . , , :
SqIDataSource, Configure Data Source
9
Choose Your Data Connection (.8), , , , New Connection, .
|
|
(+), Connection String.
10
Next, Configure The Select Statement (.9.). Specify columns from a table or view, :
Name , . , .
Columns , . , (*).
Return Only Unique Rows , , .
WHERE Add WHERE, .
ORDER BY Add ORDER BY,
Advanced , Advansed SQL Generation Options. , Generate INSERT, UPDATE and DELETE statements. , (INSERT, UPDATE, DELETE). Use optimistic concurrency. , .
, Specify a custom SQL statement or stored procedure (.10).
Specify a custom SQL statement or stored procedure , Next. Define Custom Statements or Stored Procedures (.11).
11 SQL
SELECT, UPDATE, INSERT DELETE, Query Builder. (.7), SQL , Execute Query. , OK.
Next. Test Query (.12), Test Query , . Finish. Previous .
12
, Web-, . , DropDownList , :
DataSourceID , ;
DataTextField , DropDownList. .
DataValueField , DropDownList. .
. , 3.
3 , , GridView, DetailsView FormView .
3
ASP | ||||
GridView | Update, Delete | 2.0 | ||
DetailsView | HTML , | Insert, Update, Delete | 2.0 | |
FormView | , | Insert, Update, Delete | 2.0 | |
Repeater | . | 1.0 | ||
DataList | Repeater, : , | 1.0 | ||
. GridView.
GridView "" (. 13). , : , . "" GridView.
13 ""
Web-, GridView, :
, - , .
GridView SqIDataSource , :
- " " Database Explorer ;
- GridView SqIDataSource Data Toolbox Web-.
SqIDataSource Configure Data Source.
Choose Your Data Connection, "", Next.
Configure The Select Statement, "", , , , , .
WHERE, Add WHERE : Column (), Operator (>=), Source (none), Value (10000);
Add (.14). , , Column () 10.000
14
OK, Add WHERE, ORDER BY Configure The Select Statement;
Add ORDER BY, Sort by , OK. .
Next, Test Query Finish, .
SqIDataSource , GridView, :
GridView , Choose Data Source , .
:
- Enable Paging , . , ;
- Enable Sorting , Web-, .
Edit Columns. Fields (.15). Selected Fields - " " " ", : , _, , _, .
15
Selected Fields, , BoundField Properties, , 4. ;
OK, Fields. .
4 -
- | |||||
DataField | _ | _ | |||
HeaderText | |||||
Element Style: HorizontalAlign | Left | Right | Right | Right | Right |
, Microsoft Visual Studio 2005 Web-, . , , : Data Connection, Data Source Data Bound Controls.
, - . GridView DetailsView, . GridView , DetailsView . , 16, GridView, : " " " ".
" " HTML , , , " " , " " . " " .
"" .
16 GridView
, GridView .
, . , Database Explorer, Open Table Definition. , (.17), , , , Set Primary Key .
17
Data Source GridView . , . , Data Source INSERT, UPDATE DELETE. :
Configure Data Source SqlDataSource.
Next, Configure the Select Statement.
Advanced, Advanced SQL Generation Options, , Generate INSERT, UPDATE and DELETE statements.
Advanced Generate INSERT, UPDATE and DELETE statements , Advanced SQL Generation Options, . Configure the Select Statement :
- Specify a custom SQL Statement Or Stored Procedure Next, Define Custom Statements Or Stored Procedures. , SELECT, UPDATE, INSERT, DELETE SQL .
- , Advanced Generate INSERT, UPDATE and DELETE statements.
GridView :
- Enable Editing. , GridView .
- Enable Deleting. , GridView .
- Enable Selection. , GridView .
.
DetailsView, , :
, , . SqlDataSource , Data Toolbox. SqlDataSource , "" "".
, Advanced , Generate INSERT, UPDATE and DELETE statements. DetailsView , Data Toolbox. DetailsView.
- Choose Data Source , ;
- Enable Inserting, .
Properties DetailsView. , 5. . Web-.
5 DetailsView
AutoGeneratelnsertButton | True | DetailsView "" (Insert) . |
AutoGenerateRows | False | DetailsView. |
DataKeyNames | id _ | , . |
DataSourceld | SqIDataSource1 | , . |
DefaultMode | Insert | DetailsView . |
HorizontalAlign | Center | DetailsView . |
19 , . , , : , , , , ,
19 DetailsView,
"" :
1. ( )
2. ( )
3. ( ).
NULL.
NULL | ||
id_ | ||
NULL | ||
id_ | ||
_ | ||
_ | ||
NULL | ||
id_ | . | . |
. | . | |
. | . |
:
DetailsView | GridView | |
:
, :
- , DetailsView;
- , DetailsView;
- , GridView;
- , DetailsView;
- , GridView;
, :
, DetailsView | |
, DetailsView | |
, GridView | |
, DetailsView | |
, GridView |
? , :
, DetailsView | ||
. | ||
. | ||
, DetailsView | ||
. | ||
. | ||
, GridView | ||
. | ||
. | ||
, DetailsView | ||
. | ||
. | ||
, GridView | ||
. | ||
. |
.
:
1. Database Explorer?
2. Web- Microsoft Visual Studio 2005? ?
3. , Web-?
4. GridView, DetailsView FormView .
5. GridView ?
1. . Microsoft ASP.NET 2.0. . - / . . .: ; .: , 2007. 688 .
2. ., . Microsoft SQL Server 2005. -. / . . .: , 2007. 880 .
1. , , , : , . , 2- .: . .: . .- .: , 2000.
2. . # 2005 .NET 2.0, 3- .: . .-.: ..,2007. -1168.
3. - , . Microsoft ASP.NET 2.0 # 2005 .:. .-.: ..,2006. -1408.
4. . Microsoft ASP.NET 2.0. . - / . . .: ;.:, 2007. 688 .
5. . Microsoft ASP.NET / . . .: , 2002. 480
6. ., , SQL Server 2005 Analysis Services MDX ,2008 .-848.