Forums

ASP

This topic is locked

Ignore record 1 in my record set in ASP

Posted 20 May 2005 12:48:24
1
has voted
20 May 2005 12:48:24 Paul Hetherington posted:
I have trying to create a sql query the displays from recod two and ill use the repeat region bit in dreamweaver to show the rest after it, its basically a news secition that record one (the lastest posted) is styled diferent to the rest, im not sure if it need to be a sql thing in my record set or a asp thing in my code, any ideas out there

Cheers Paul

Edited by - The Sluap on 31 May 2005 19:12:17

Replies

Replied 20 May 2005 14:29:59
20 May 2005 14:29:59 Dave Thomas replied:
just do your repeat region as normal and then look for the code like this

<pre id=code><font face=courier size=2 id=code>
&lt;%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = 4
Repeat1__index = 0
rsArticles_numRows = rsArticles_numRows + Repeat1__numRows
%&gt;
</font id=code></pre id=code>

and change Repeat1__index = 0

to

Repeat1__index = 2 (to start at record id 2)

regards

Dave Thomas
<b>DMX Zone Manager</b>
Replied 20 May 2005 16:38:32
20 May 2005 16:38:32 Paul Hetherington replied:
thx
i did that and it still just displays all my records, it does not start at record 2

any ideas?
Replied 27 May 2005 20:37:31
27 May 2005 20:37:31 Javier Castro replied:
I do not know if this will help or if you already solved your problem, but, just in case here we go:

&lt;%
Dim rsDisplaytest__MMColParam
rsDisplaytest__MMColParam = "1"
If (Request("MM_EmptyValue" &lt;&gt; "" Then
rsDisplaytest__MMColParam = Request("MM_EmptyValue"
End If
%&gt;
&lt;%
Dim rsDisplaytest
Dim rsDisplaytest_numRows

Set rsDisplaytest = Server.CreateObject("ADODB.Recordset"
rsDisplaytest.ActiveConnection = MM_connCMS_STRING
rsDisplaytest.Source = "SELECT intPostID FROM tblPosts WHERE intPostID &lt;&gt; " + Replace(rsDisplaytest__MMColParam, "'", "''" + " ORDER BY intPostID ASC"
rsDisplaytest.CursorType = 0
rsDisplaytest.CursorLocation = 2
rsDisplaytest.LockType = 1
rsDisplaytest.Open()

rsDisplaytest_numRows = 0
%&gt;


Cheers,

Javier
Replied 31 May 2005 19:11:40
31 May 2005 19:11:40 Paul Hetherington replied:
i have been told it is best to do this in asp not in the query any idea's
Replied 01 Jun 2005 01:55:05
01 Jun 2005 01:55:05 Dave Thomas replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
thx
i did that and it still just displays all my records, it does not start at record 2

any ideas?
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

i use this quite a lot for headlining certain records.

you could always just use

WHERE myrecordid NOT 1

in your query.

regards

Dave Thomas
<b>DMX Zone Manager</b>
Replied 09 Jun 2005 16:27:54
09 Jun 2005 16:27:54 Paul Hetherington replied:
This works great but is is only not showing the ID number i choose not the record, as they all have diferent id numbers the latest is not always 1 etc etc

any ideas?
Cheers Paul
Replied 10 Jun 2005 17:06:40
10 Jun 2005 17:06:40 adam partridge replied:
this should do the trick

SELECT field FROM table WHERE field NOT IN (SELECT TOP 1 field FROM table)

Replied 10 Jun 2005 17:11:14
10 Jun 2005 17:11:14 Paul Hetherington replied:
SELECT *
FROM tbl_news
ORDER BY news_date DESC

this is what i have atm how would i include the above cheers
Replied 11 Jun 2005 18:21:40
11 Jun 2005 18:21:40 adam partridge replied:
SELECT * FROM tbl_news WHERE autonumberfield NOT IN (SELECT TOP 1 autonumberfield FROM tbl_news)
but you could have guessed that if u put a little effort in <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

Reply to this topic