Posts

Showing posts from February, 2016

SPJobLockType

Image
Architecture: There are 8 Servers in all.. 1 Database Server 1 Mail Server 2 Web-FrontEnds 4 App Servers (out of which one is the Central Admin and also a Web Frontend) Observation: If you take a look at the Job Status in the Operations tab of the Central Admin, we can see that some jobs are running 6 instances, some 3 and some 1 instance. The number of instances is controlled by the SPJobLockType parameter that has to be passed to your job constructor. ( For a guide to creating custom jobs refer Andrew Connell's article http://www.andrewconnell.com/blog/articles/CreatingCustomSharePointTimerJobs.aspx  ) There are 3 Locks available.. SPJobLockType.None -- if you set it none, the instance will run in all the available servers in the Farm (e.g. Application Server Timer Job) SPJobLockType.ContentDatabase – this will cause 3 instances to be running in each of the Web-Frontends. SPJobLockType.Job – this will cause only one instance of the job to run on any of the front-end ser...

Find third or nth maximum salary from salary table

Row Number : SELECT Salary , EmpName FROM ( SELECT Salary , EmpName , ROW_NUMBER () OVER ( ORDER BY Salary ) As RowNum FROM EMPLOYEE ) As A WHERE A . RowNum IN ( 2 , 3 ) Sub Query : SELECT * FROM Employee Emp1 WHERE ( N-1 ) = ( SELECT COUNT ( DISTINCT ( Emp2 . Salary )) FROM Employee Emp2 WHERE Emp2 . Salary > Emp1 . Salary ) Top Keyword : SELECT TOP 1 salary FROM ( SELECT DISTINCT TOP n salary FROM employee ORDER BY salary DESC ) a ORDER BY salary

Bind Dynamic Table in MVC

EmployeesController   public ActionResult Index()  {      return View();  }   //GET JSON Method for Get details   public JsonResult GetEmployeeDetails( int ID, string tableName)  {      JsonResult json = new JsonResult ();      DataTable dtEmployeeDetails = new DataTable ();      dtEmployeeDetails = GetDetails(tableName);      if (dtEmployeeDetails != null )      {          string returnData = GetJson(dtEmployeeDetails);          json.JsonRequestBehavior = JsonRequestBehavior .AllowGet;          json.Data = returnData;          return json;          //  return Json(returnData, JsonReq...

LINQ to SQL LIKE Operator

Image
LINQ to SQL LIKE Operator By using Contains(), StartsWith(), EndsWith() we can implement LIKE operator in LINQ to SQL. like '%SearchString%' = Contains("SearchString") like '%SearchString' = StartsWith("SearchString") like 'SearchString%' = EndsWith("SearchString") Input tables Employees table LINQ Query Contains(): MyDBDataContext  sqlObj =  new   MyDBDataContext (); var  employees =  from  emps  in  sqlObj.tblEmployees                  where  emps.EmployeeName.Contains( "en" )                  select   new                 {                     emps.EmployeeID, ...