[ impact @ 08.04.2002. 00:41 ] @
Da li neko ima resenje za izlistavanje rezultata iz baze po stranicama? Npr 10 rezultata po jednoj stranici! |
[ impact @ 08.04.2002. 00:41 ] @
[ jc denton @ 08.04.2002. 00:42 ] @
Imam ja, ali u php-u. Mislim da bi lako preradio za VB.
[ impact @ 08.04.2002. 00:56 ] @
Citat: Mislim da bi lako preradio za VB. Ajde ako ti ne predstavlja problem! [ jc denton @ 08.04.2002. 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 [ jc denton @ 08.04.2002. 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'. [ impact @ 08.04.2002. 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. [ Rodd @ 14.04.2002. 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. Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.
|