I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
Redundancy is each second programmer’s problem in querying with sql programming. Sql programming provides some in-built keyword that may be used to remove this problem. The article shows syntax and use of this keyword with examples.
When there is a requirement to eliminate rows with duplicate values in a column, the DISTINCT keyword is used. The DISTINCT keyword eliminates the duplicate rows from the result set.
The syntax of the DISTINCT keyword is:
SELECT [ALL|DISTINCT] column_names
FROM table_name
WHERE search_condition
Where
In a query that contains the DISTINCT keyword, you can specify more than one column name. In that case, the DISTINCT keyword is applied to all the columns that are there in the select list. You can specify DISTINCT only before the select list. The following SQL query retrieves all the Titles beginning with PR from the Employee table:
SELECT DISTINCT JobTitle FROM HumanResources.Employee WHERE JobTitle LIKE 'PR%'
Output: The result contains all the records of employee table having PR, the starting two characters. The query will display only the JobTitle field, as specified in the query.
When there is a requirement to eliminate rows with duplicate values in a column, the DISTINCT keyword is used. The DISTINCT keyword eliminates the duplicate rows from the result set.
The syntax of the DISTINCT keyword is:
SELECT [ALL|DISTINCT] column_names
FROM table_name
WHERE search_condition
Where
- column_names: name of fields to be displayed in output.
- table_name: name of table from which records are to be retrieved.
- Search_condition: mostly used to filter the output.
- DISTINCT keyword specifies that only the records containing non-duplicated values in the specified column are displayed.
In a query that contains the DISTINCT keyword, you can specify more than one column name. In that case, the DISTINCT keyword is applied to all the columns that are there in the select list. You can specify DISTINCT only before the select list. The following SQL query retrieves all the Titles beginning with PR from the Employee table:
SELECT DISTINCT JobTitle FROM HumanResources.Employee WHERE JobTitle LIKE 'PR%'
Output: The result contains all the records of employee table having PR, the starting two characters. The query will display only the JobTitle field, as specified in the query.
Comments
Post a Comment