Novo

Forum kao aplikacija na telefonu

Dodajte forum na početni ekran i koristite ga kao aplikaciju, sa menijem na dnu ekrana.

  • 6 odgovora
  • 7.351 pregleda

Najnovija ↓

Paging kroz RecordSet 08.04.2002. u 01:41 · pre 299 meseci #1
Da li neko ima resenje za izlistavanje rezultata iz baze po stranicama?
Npr 10 rezultata po jednoj stranici!
Re: Paging kroz RecordSet 08.04.2002. u 01:42 · pre 299 meseci #2
Imam ja, ali u php-u. Mislim da bi lako preradio za VB.
Potpis
fire, walk with me
Re: Paging kroz RecordSet 08.04.2002. u 01:56 · pre 299 meseci #3
Citat:
Mislim da bi lako preradio za VB.


Ajde ako ti ne predstavlja problem!
Re: Paging kroz RecordSet 08.04.2002. u 02:03 · pre 299 meseci #4
Uz poruku je php skript koji odradjuje nesto slicno kao Google. Nadam se da ti nece biti tesko da prebacis na VB.

pozdrav
Potpis
fire, walk with me
Re: Paging kroz RecordSet 08.04.2002. u 02:39 · pre 299 meseci #5
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'.
Potpis
fire, walk with me
Re: Paging kroz RecordSet 08.04.2002. u 02:40 · pre 299 meseci #6
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.
Re: Paging kroz RecordSet 14.04.2002. u 02:09 · pre 298 meseci #7
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.
Potpis
http://www.rodpetrovic.com
http://lista.rodpetrovic.com
Prijavite se da biste odgovorili u ovoj temi.PrijavaRegistracija

Premeštanje teme