Bernd
|
| Posted: 01/22/2006, 10:10 AM |
|
Hi Guys,
I'm using the following SQl code:
SELECT TOP 5 *
FROM books
WHERE
active = 1
ORDER BY NEWID()
When I test the code in the "Datasource-review data" it shows me 5 really random records and works great.
When I however publish the page and run it the records tend to be sequential ???
How on earth does this work ?
Any clues for me please.
|
|
|
 |
Benjamin Krajmalnik
|
| Posted: 01/22/2006, 1:34 PM |
|
http://www.4guysfromrolla.com/webtech/102999-1.shtml
|
|
|
 |
dragoon
Posts: 173
|
| Posted: 01/22/2006, 2:19 PM |
|
Quote Benjamin Krajmalnik:
too much trouble compared to the intial solution.
Bernd, have you set-up some caching?
|
 |
 |
Bernd
|
| Posted: 01/23/2006, 6:46 AM |
|
Hi,
No caching set up at all.
I had a look at the page supplied, WOW, my little code seems so easy and works well, just not on the page.
It tends to pick a random starting record and then go sequentail from there.
I tried the code on a simple asp page and there it works as per in the revew data, so there is definately something I'm missing.
Bernd
|
|
|
 |
dragoon
Posts: 173
|
| Posted: 01/23/2006, 7:30 AM |
|
definitively you're missing smth.
i have tried in a project in .NET, I'm curently working on and random sorting it's working.
what version of CCS do you have?
|
 |
 |
Benjamin Krajmalnik
|
| Posted: 01/23/2006, 2:05 PM |
|
I agree.
The code he showed should work.
But, when something does not work sometimes time dictates a workaround.
|
|
|
 |
Bernd
|
| Posted: 01/24/2006, 1:27 AM |
|
This is still a Ver2.3.2.26 project
Only other code on th epage is a "before show" custom code for a picture and it works fine:
Dim filespec, FSO
filespec = books.picture.Value
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
If FSO.FileExists( Server.MapPath( filespec) ) Then
books.picture.Value = filespec
Else
books.picture.Value = "./images/books/no.jpg"
End If
The code for the construction of the gris in the html file is as follows and also works fine:
<table width="100%">
<tr>
<td class=""></td>
</tr>
<tr>
<!-- BEGIN Row -->
<td align="center"><a onmouseover="return overlib('{Link1}');" onmouseout="return nd();" href="{picture}"><img src="{picture_Src}" border="0"></a><br>
<strong></strong><input type="hidden" name="{Link1_Name}" value="{Link1}"></td><!-- END Row -->
</tr>
<!-- BEGIN NoRecords --><!-- END NoRecords -->
</table>
That is it. Nothing funny here at all.
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 01/24/2006, 3:25 AM |
|
Bernd,
In case of any SQL problems I would start by verifying what query is executed by the application, in case an additional ORDER BY field was added, or parentheses removed from NEWID() by CCS, etc. There is a section on debugging in CCS documentation: http://docs.codecharge.com/studio3/html/ProgrammingTech...yingOutput.html
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
Walter Kempees
|
| Posted: 01/24/2006, 4:09 AM |
|
Bernd,
Without adding a solution, I wonder:
Your test database what is it? Acces? SQL2k?
Your webserver (after publish) what DB is that ?
"Bernd" <Bernd@forum.codecharge> schreef in bericht
news:643d3caa74887a@news.codecharge.com...
> Hi Guys,
>
> I'm using the following SQl code:
> SELECT TOP 5 *
> FROM books
> WHERE
> active = 1
> ORDER BY NEWID()
>
> When I test the code in the "Datasource-review data" it shows me 5 really
> random records and works great.
>
> When I however publish the page and run it the records tend to be
> sequential
> ???
>
> How on earth does this work ?
>
> Any clues for me please.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
Bernd
|
| Posted: 01/25/2006, 1:49 PM |
|
Both DB's are SQL2000 SP4
|
|
|
 |
Bernd
|
| Posted: 02/05/2006, 4:03 AM |
|
To to finalize...
I re-created the project in ver 3 now and the problem is solved using my original code. Works like a dream.
Thanks
Bernd
|
|
|
 |