SQL SERVER – Server Side Paging in SQL Server 2005 or 2008


–creating the table.
create table dbo.EmployeeTable
(
EmpId int identity primary key,
EmpName varchar(40),
Sal int
)
go

–inserting data into table
insert into EmployeeTable values(‘ranga’,2000),(‘rajesh’,3000),(‘kumar’,4000),(‘swapna’,5000),(‘gopi’,6000)

–creating view.
create view pagingView
as
select empid,empname,sal from EmployeeTable
go

–creating procedure
CREATE PROCEDURE [dbo].[spPaging]
(
@PageNumber int,
@PageRecordsSize int
)
AS
begin
SET NOCOUNT ON;

SELECT TOP(@PageRecordsSize) * FROM
(
SELECT Row_ID = ROW_NUMBER() OVER (ORDER BY empid),
empid, empname, sal, TotalRows=Count(*) OVER()
FROM pagingView
)
A WHERE A.Row_ID > ((@PageNumber-1)*@PageRecordsSize)
SET NOCOUNT OFF
end
go

exec spPaging 1,5

Event handler generation in Visual Studio 2012


Categories: VisualStudio , VisualStudio2012
This post will be a part of Visual Studio 2012 feature series.

There are lots of new features there in visual studio 2012. Event handler generation is one of them. In earlier version of visual studio there was no way to create event handler from source view directly. Now visual studio 2012 have event handler generation functionality.

So if you are editing an event view in source view intellisense will display add new event handler template and once you click on it. It will create a new event handler in the cs file. It will also put a eventhandler name against event name so you don’t need to write that.

So, let’s take a simple example of button click event so once I write onclick attribute their smart intellisense will pop up
.b
Event handler generation in visual studio 2012 – What’s new in visual studio 2012

Now once you click on It will create event handler in .cs file like following.

Event Handler in asp.net with visual studio 2012 – What’s new in visual studio 2012
d
It will also put submitButton_Click on onClick attribute.

Create event new handler in visual studio 2012 – new feature of visual studio 2012
C
Hope you liked it. Stay tuned for more. Till then happy programming..