Trigger
Existing dictionary table (Dict)
| Field |
Description |
|
Mark |
| ItemKey |
Key |
| ItemValue |
Value |
| UpperId |
Upper Layer ID |
Requirement 1: when a new record is added, if the same key already exists, insertion is rejected.
ANSI_NULLS QUOTED_IDENTIFIER . . ( () , inserted inobj .ItemKey inobj.ItemKey .Id inobj.Id) (,,
Requirement 2: When a record is deleted, it is rejected if a lower-level record exists.
ANSI_NULLS QUOTED_IDENTIFIER . . ( () , deleted delbj .UpperId delbj.Id) (,,
Requirement 3: When a record is deleted, if a lower-level record exists, the lower-level record is also deleted.
ANSI_NULLS QUOTED_IDENTIFIER . .( () UpperId UpperId ( Id )) UpperId UpperId ( Id
Stored Procedure
Existing User table)
| Field |
Description |
| Id |
Mark |
| Name |
Name |
| Age |
|
| DeptId |
Department ID |
Department table (Dept)
Requirement 1: use stored procedures to query information of all users (ID, name, age, and department name)
ANSI_NULLS QUOTED_IDENTIFIER . .Id ,.Name , .Age , .Name .DeptId
GetUsers
Requirement 2: Use the stored procedure to query the user information (ID, name, age, and department name) of a specified department)
ANSI_NULLS QUOTED_IDENTIFIER . .Id ,.Name , .Age , .Name .DeptId .Id
GetUsersByDept
Requirement 3: Call the Stored Procedure 'getusersbydept' using ADO in the project'
1. Environment: VS2010 + sql2008
2. Create an edmx file and reference two tables and stored procedures.
3. Switch to 'model browser' and 'add function import'
4. On the 'Add function import' panel, click 'retrieve column information'. After obtaining column information, click 'create complex type ', after confirmation, you can call the stored procedure through Func.
5. Call the code Demo
( context = result = context.GetUsersByDept(
2013
Why is mixing so bad?
Why is it so uncomfortable?
But why is it so calm?
I chose to keep the status quo instead of having never thought about changes, but cannot be imprison-free.
We hope 2014 will change somewhat.
At present, I can only comfort myself with the phrase "I am myself, I am a fireworks of different colors ".