Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Paging kroz RecordSet

[es] :: Visual Basic 6 :: Paging kroz RecordSet

[ Pregleda: 1697 | Odgovora: 6 ]

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

impact
Vladimir Golušin
Kikinda

Član broj: 2517
Poruke: 109
212.200.76.*

Sajt: www.2point.co.yu


Profil

icon Paging kroz RecordSet08.04.2002. u 00:41

Da li neko ima resenje za izlistavanje rezultata iz baze po stranicama?
Npr 10 rezultata po jednoj stranici!
08.04.2002. u 00:41 

jc denton

Član broj: 2358
Poruke: 1705
*.tehnicom.net



Profil

icon Re: Paging kroz RecordSet08.04.2002. u 00:42
Imam ja, ali u php-u. Mislim da bi lako preradio za VB.
...za sada samo citam.
08.04.2002. u 00:42 

impact
Vladimir Golušin
Kikinda

Član broj: 2517
Poruke: 109
212.200.76.*

Sajt: www.2point.co.yu


Profil

icon Re: Paging kroz RecordSet08.04.2002. u 00:56
Citat:
Mislim da bi lako preradio za VB.


Ajde ako ti ne predstavlja problem!
08.04.2002. u 00:56 

jc denton

Član broj: 2358
Poruke: 1705
*.tehnicom.net



Profil

icon Re: Paging kroz RecordSet08.04.2002. u 01:03
Uz poruku je php skript koji odradjuje nesto slicno kao Google. Nadam se da ti nece biti tesko da prebacis na VB.

pozdrav
...za sada samo citam.
Prikačeni fajlovi
08.04.2002. u 01:03 

jc denton

Član broj: 2358
Poruke: 1705
*.tehnicom.net



Profil

icon Re: Paging kroz RecordSet08.04.2002. u 01:39
Ima jos jedna fina stvar, bar u MySQL-u :

SELECT * FROM TABELA LIMIT m,n

citiram iz MySQL manual-a :

* The `LIMIT' clause can be used to constrain the number of rows
returned by the `SELECT' statement. `LIMIT' takes one or two
numeric arguments.

If two arguments are given, the first specifies the offset of the
first row to return, the second specifies the maximum number of
rows to return. The offset of the initial row is 0 (not 1):

mysql> select * from table LIMIT 5,10; # Retrieve rows 6-15

If one argument is given, it indicates the maximum number of rows
to return:

mysql> select * from table LIMIT 5; # Retrieve first 5 rows

In other words, `LIMIT n' is equivalent to `LIMIT 0,n'.
* The `LIMIT' clause can be used to constrain the number of rows
returned by the `SELECT' statement. `LIMIT' takes one or two
numeric arguments.

If two arguments are given, the first specifies the offset of the
first row to return, the second specifies the maximum number of
rows to return. The offset of the initial row is 0 (not 1):

mysql> select * from table LIMIT 5,10; # Retrieve rows 6-15

If one argument is given, it indicates the maximum number of rows
to return:

mysql> select * from table LIMIT 5; # Retrieve first 5 rows

In other words, `LIMIT n' is equivalent to `LIMIT 0,n'.

...za sada samo citam.
08.04.2002. u 01:39 

impact
Vladimir Golušin
Kikinda

Član broj: 2517
Poruke: 109
212.200.76.*

Sajt: www.2point.co.yu


Profil

icon Re: Paging kroz RecordSet08.04.2002. u 01:40
Citat:
jc denton: Nadam se da ti nece biti tesko da prebacis na VB.


Pa ne znam PHP, ali probaću. Ukoliko budem imao problema, staviću post na forum.
08.04.2002. u 01:40 

Rodd
Rodoljub Petrović
web developer, Extreme
Beograd

Član broj: 242
Poruke: 358
*.absolutok.net

ICQ: 114756071
Sajt: www.rodpetrovic.com


Profil

icon Re: Paging kroz RecordSet14.04.2002. u 01:09
Objekat ADODB.Recordset već ima ugrađen paging u sebe, koji je besmisleno lak za korišćenje: Pravac ovde.

Inače ako je baza sa kojom radiš SQL Server, za paging možeš da koristiš i storniranu proceduru, što je mnogo efikasnije. Evo primera koji sam ja uradio skoro:

Code:

CREATE PROCEDURE sp_Stranice
 (
  @Page int,
  @RecsPerPage int,
  @SQLString nvarchar(4000)
 )
AS
 
SET NOCOUNT ON
 
CREATE TABLE #TempItems
(
 ID int IDENTITY,
 ProdavnicaID int,
 TrzniCentar nvarchar(50),
 Prodavnica nvarchar(50),
 Opis nvarchar(255),
 DelatnostID int,
 TCID int,
 KR nvarchar(4000)
)
 
INSERT INTO #TempItems (ProdavnicaID,TrzniCentar,Prodavnica,Opis,DelatnostID,TCID, KR)
EXEC(@SQLString)
 
DECLARE @FirstRec int, @LastRec int
SELECT @FirstRec = (@Page - 1) * @RecsPerPage
SELECT @LastRec = (@Page * @RecsPerPage + 1)
 
SELECT *,
       MoreRecords = 
 (
  SELECT COUNT(*) 
  FROM #TempItems TI
  WHERE TI.ID >= @LastRec
 ) 
FROM #TempItems
WHERE ID > @FirstRec AND ID < @LastRec
 
SET NOCOUNT OFF
GO


Originalnu proceduru i sva pojašnjenja naći ćeš ovde.

Pozdrav.
14.04.2002. u 01:09 

[es] :: Visual Basic 6 :: Paging kroz RecordSet

[ Pregleda: 1697 | Odgovora: 6 ]

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.