here is my sql -
PROCEDURE [dbo].[spMobileSearch]
-
(
-
@pg int,
-
@pgSize int,
-
@text varchar(250)
-
)
-
AS
-
BEGIN
-
Create table #temp
-
(
-
id int identity primary key,
-
intTitleId int,
-
vcTitleName varchar(250),
-
intYear int,
-
vcCertificate varchar(250),
-
vcImageName varchar(250),
-
vcTitleDescription varchar(4000),
-
actor varchar(4000)
-
)
-
-
-
SET NOCOUNT OFF
-
-
Insert into #temp(intTitleId, vcTitleName, intYear, vcCertificate, vcImageName, vcTitleDescription, actor)
-
-
select *
-
from Titles
-
-
-
declare @from int
-
declare @to int
-
set @to=@pg * @pgSize
-
Set @from= @pg * @pgSize-@pgsize
-
-
Select * from #temp where id>@from and id<=@to
-
Select count(*) from #temp
-
drop table #temp
-
SET NOCOUNT ON
-
END
-
dont mind the select statment, just took it out to make it look less clunky
Problem: This pager does exactly what i want it to do but struggles when it comes to a big resultset. E.g everytime you click next in the asp page, it feels like it is searching the db again and this slows the pager down a lot.
2 1884
I have found a solution to this problem and speeds up the paging supper fast -
PROCEDURE [dbo].[spMobileSearch]
-
(
-
@pg INT,
-
@pgSize INT,
-
@text varchar(250)
-
)
-
AS BEGIN
-
-
WITH Search AS
-
(select distinct ROW_NUMBER() OVER (Order by T.intTitleId) AS RowID, T.intTitleId, from tites.....)
-
-
SELECT rowid, intTitleId, vcTitleName, intYear, vcCertificate, vcImageName, vcTitleDescription, actor
-
FROM Search WHERE RowID BETWEEN
-
((@pg - 1) * @pgSize) + 1 AND @pg * @pgSize
-
ORDER BY RowID
-
-
It is searching the DataBase again.
You could use an ASP.NET control like the DataView which has paging functionality. This way you make 1 call to the database to populate the DataView and then cache the DataView into ASP.NET cache or Session (or something) so that you don't need to make more calls the database.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Richard |
last post by:
My employer currently pays me $1/hour when I carry a pager. I have to
carry the pager every fourth week. The problem is that my employer
insists that I be available when I'm carrying the pager. ...
|
by: john_20_28_2000 |
last post by:
Does anyone know of anything out there that I can use to dial up a
numeric pager, leave a number and then hang up? It is not a "fancy"
pager. No message, not text, no nothing. Just a regular old...
|
by: Ben |
last post by:
Hi, I'd like to have a datagrid that has a dropdownlist in the pager control
for setting the page size. I can get the control into the pager inside the
datagrid itemcreated event by checking for...
|
by: strout |
last post by:
I know it's dumb ... sometimes frustrating
I want the text and a dropdownlist align with both side of a table cell,
i.e. text align left and dropdownlist align right. I cannot add more cells to...
|
by: James T. |
last post by:
Hello!
I am using following code to customize DataGrid Pager. It works fine...
My question is, how I can replace" " with " | " between each LinkButton
control?
Thanks!
James
Dim...
|
by: Ray |
last post by:
I am trying to add a "Next >" and "<Prev" button to the pager of my datagrid.
I have been able to add the hyperlinks to the pager. I am now trying to
determine the correct postback script to...
|
by: SMichal |
last post by:
Hi, I need a liitle help with build of my custom pager for gridview...I made
this kind of pager..I looks like this:
<< < 1 2 3 4 5 6 7 8 9 10 >
Well...it's no bad but I wannt something like...
|
by: =?Utf-8?B?QHdpbg==?= |
last post by:
Hello There,
I need to page a pager whenever an error event takes place in my app.
What is the best approach in this?
Should I use and modify the SerialPort class to talk to the modem.
I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |