Tips/Tricks

5 steps to ensure the salary you want

The world is never an easy place when it comes to competition. And many are supposed to experience a chill in the spine when I specify competition in today's tight job market. Being in today's job market, experiencing the 'rolling stone' feeling, it read more

How to setup multiple startup projects in Visual Studio ?

click here

Enum.HasFlag method in C# 4.0

Enums in dot net programming is a great facility and we all used it to increase code readability. In earlier version of .NET framework we don’t have any method anything that will check whether a value read more

Selecting Cache Provider On the Fly in ASP.NET

If you have multiple Cache Provider in your application you can  set the output cache provider dynamically at runtime .  This is extremely useful if want to store cache data in different storage based on the usages of the data.Read more..

Custom Paging Using store Procedure

Resolve performance issue in web application it is require to use custom paging using store procedure in our application here is store procedure how can we achieve custom paging and sorting using store procedure SQl server 2005 or above version of SQl server.

create PROCEDURE [dbo].[Product_Master_list]
	-- Add the parameters for the stored procedure here
	@sortedcolumn varchar(50),
	@sortexpression varchar(50),
	@StartRowIndex int,
	@MaxRows		int,
	@totalRows int OUTPUT
AS
BEGIN
	SET NOCOUNT ON;
	declare  @SQl nvarchar(2000)
	declare	@OrderQuery  nvarchar(2000)
	declare	@OrderQuery1  nvarchar(2000)
	DECLARE @ProductTable TABLE(ID int identity(1,1),ProductId int,
				    ProductName nvarchar(200))

SET @OrderQuery = ' ORDER BY ' + @sortedcolumn +' ' + CASE @sortexpression 
	WHEN 'asc' THEN ' ASC ' ELSE ' DESC ' END
DECLARE @nextStartIndex int
	
set @SQl =  'SELECT Product_ID as ProductID, ProductName as ProductName FROM (
	SELECT 	ROW_NUMBER() OVER ('+ @OrderQuery +')
			AS [ROW_NUMBER], 
			[t0].[Product_ID], [t0].[ProductName] 
			FROM [dbo].[ProductMaster] AS [t0]) t
			WHERE [ROW_NUMBER] BETWEEN 
			@StartRowIndex AND @MaxRows' + @OrderQuery
					print @SQl
insert into @ProductTable 
EXEC sp_Executesql @SQl,
			N'@OrderQuery nvarchar(max),
		 	@StartRowIndex int,@MaxRows int',
			@OrderQuery=@OrderQuery,
			@StartRowIndex = @StartRowIndex,
			@MaxRows = @MaxRows
select @totalRows= count(Product_ID) from ProductMaster
select * from @ProductTable order By ID
	
END

We can use wildcard search in LINQ using Sqlmethod class Like Method

I just learned we can use SqlMethod class Like method as wildcard search in LINQ statement Example 

Read more..