Join Query using Entity FrameWork

Posted in C#, LINQ, MVCTagged ,

In this article i am explaining how to use JOIN method in Entity Framework. Below is very simple and easy example. var query = db.Employee // source .Join(db.Salary, // target c => c.EmployeeID, // FK cm => cm.EmployeeID, // PK (em, sal) => new { Employee = em, Salary = sal }) // project result….

Asp.Net DataTable Crud Operations

In the .Net developer’s life it is very common to come across the datatable manipulation. So here i have decided to explain the datatable manipulation like adding ,editing , updating or deleting records from datatable based on the condition and apply sorting datatable based on columns. DataTable: It represents one table of in-memory relational data,….

How to get top 10 records in linq

In this article i am explaining how to get top 10 records in LINQ. below is very simple and easy example. var top10 = (from u in db.Users orderby u.UserId descending select u).Take(10); Note: If you take method then must be use order by clause.  

Partial View in ASP.NET MVC

Partial View in ASP.NET MVC like a  User Control in ASP.NET Web Forms. In order to reuse a View in our MVC application (For example, use a header, list of items or footer etc.), Partial Views are introduced that basically renders inside a Parent View. Let’s give an example to understand the concept of Partial Views in more….

ASP.NET MVC vs ASP.NET WebForms

In this article i am explaining mazor different   between Asp.MVC vs Asp.Net Web Forms. ASP.NET WebForms ASP.NET Web Forms uses Page controller pattern approach for rendering layout. In this approach, every page has it’s own controller i.e. code-behind file that processes the request. No separation of concerns. As we discussed that every page (.aspx)….

What is view state in asp.net

In Asp.Net ViewState is used for maintain the state of asp.net controls during page postback and if we save any control values or anything in viewstate we can access those values throughout the page whenever it required for that check below very simple example. <html xmlns=”http://www.w3.org/1999/xhtml”> <head runat=”server”> <title>View State in asp.net </title> </head> <body> <form….

What Is the Difference Between a Join and a UNION?

Posted in DATABASES, SQL SERVERTagged , ,

Joins and Unions can be used to join data from one or one more tables.  The difference lies in how the data is combined. In simple terms, joins combine data into new columns.  If two tables are joined together, then the data from the first table is shown in one set of column alongside the….

Validation in MVC

Validation is an important point in ASP.NET MVC applications. It is used to check whether the user input is valid. ASP.NET MVC provides a set of validation that is easy-to-use and at the same time, it is also a powerful way to check for errors and, if necessary, display messages to the user. Adding Validation….

What is Sub queries?

Posted in DATABASES, SQL SERVERTagged ,

SQL Sub queries are the queries which are set inside another query. The set queries are called as INNER query & container query is called as OUTER query. The subqueries are the queries which are executed inside of another query. The result SQL query is totally depends on the result of sub query. First the INNER….

SQL Create DataBase

SQL Create DataBase The CREATE DATABASE Statement is used to create a database in SQL. After creating a database, we can create some other database objects like  (tables, views, procedures etc.) into it. The user should have admin privileges for creating database.: SQL CREATE DATABASE Syntex: CREATE DATABASE database_name   CREATE DATABASE Example: If you….