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 }); }
Today i facing a new problem that is
Incorrect syntax near the keyword 'from'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'from'.
If you use aggregate operators query then should use '()' like
Select count (*) from [products]
Incorrect syntax near the keyword fromI am receiving this error message when i retrieve the record from the database table, this code is successfully run in visual studio 2010 or earlier but not successfully run in vs 2012 or higher. So I think about that error and solve the problem that is
Incorrect syntax near the keyword 'from'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'from'.
Solution
use brackets around the table like
Select * from [products]If you use aggregate operators query then should use '()' like
Select count (*) from [products]
Comments
Post a Comment