August 6, 2001 at 5:50 pm
Thanks guys,
This is my first time programming in ASP and in a SQL server environment. There is a reason why I dun want to use the Top 20 thingie. Cos i want to be able to display it in pages of 20. Anyway, I have found my time out bug. My page consists of multiple Include ASP files and it actually lies in one of these files. But the check for EOF still doesn't work though. I had to use a counter check within the loop to break out of it.
Marvin
August 6, 2001 at 7:58 pm
When you say the the EOF line does not work, what exactly is the behavior/messages that you are getting as you step through the code?
August 7, 2001 at 12:24 am
The case is like this :
I have a random banner generator. It generates a random number and grabs from the database the image name via the ID. But first it checks if the categories match(if any) through a Select statement. If there is no match, of course it will return an empty recordset right. Then I will loop until it finds a suitable matching record. Is there any simpler way to do this?
Marvin
August 7, 2001 at 4:31 am
Hey Marvin,
Could you post the code as you have it now. Used correctly checking for BOF and EOF will work - in fact, doing it ANY other way is bad! Depending on your cursor type, records could get added or removed from the table - throwing off your count and resulting in that ugly move past end of recordset error.
Andy
August 7, 2001 at 2:11 pm
There is a banneradrotator built into the asp object set. I would read wrox book on beginning asp and asp databases to get a good start on what you are wanting to do. Also check out http://www.asp101.com they have what you are looking for to page through record sets x number a page.
Wes
August 7, 2001 at 2:30 pm
Wes is right, it's called the Ad Rotator component. Basically you create a text file (Rotator Schedule File) with the list of graphics, any links that may be associated with them (for instance, if the image is clicked), and the percentage weight for a given image. The catch is that the images must all be the same size. There should be samples of it on any default IIS install. I've not used it in any of my apps (because I've never had the need for rotating banners) however I've tutored on the use of the Ad Rotator component and it's not hard. Here's the Microsoft page on it:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iisref/html/psdk/asp/comp59f8.asp
K. Brian Kelley
K. Brian Kelley
@kbriankelley
August 7, 2001 at 3:10 pm
Marvin,
For the record, I have to agree with the last few posts about using a canned package - but only if it does what you need (sometimes it's easier to revise your "needs list"). However, I'm still curious about your particular problem. Can you psot the code that is giving you trouble?
August 7, 2001 at 3:12 pm
... that should read "Can you POST the code...". Typing is not one of my strong points.
August 9, 2001 at 10:16 pm
haha...thnx guys...I have sorta corrected the error. It lies in one of my other Include files deep within, which does the endless loop. So the EOF actually works..sorry guys... ;P
However, I prefer to customise the entire random ad rotator to my personal needs, so I decided to write the coding on my own.
To correct the endless loop, i put in a count to limit the number of times to get the random number. But i think its unnecessary. Will be changing the coding after I get the administration engine up and working first. 🙂
Once again, Thanks for making me realising my mistake....
Oh yah btw, I know this has nothing to do with the above mentioned problem but I have recently shifted my server machine to a non internet LAN Network running through a local hub. Naturally, the IP address changes. I have changed the "Data Source" in my connection string. But it still gives an error :
Error Type :
(0x80004005)
Unspecified Error
-->rsConn.Open SQLdb (this is the line where the error points to)
wierd rite??
Edited by - marvinkwan on 08/10/2001 12:16:23 AM
August 10, 2001 at 3:40 am
haha...guys...hehe..i solved dat issue also...thanks...managed to solve it by changing the Data Source to "localhost" but this problem is wierd rite??..anyone who knows why this happens?? Just wanna know for informational purposes only. 🙂
August 13, 2002 at 1:52 am
Sorry about the lateness of this post.
I've found that @@ROWCOUNT gets its knickers in a twist with triggers.
INSERT DestinationTable(Fields)
SELECT Source.Fields
FROM SourceTable
WHERE Some Clause
SELECT @@ROWCOUNT
If DestinationTable has a trigger then @@ROWCOUNT seems to return the records affected by the trigger.
The confusing thing is that sometimes it doesn't. I've a feeling that this is something to do with whether nested triggers are allowed.
Viewing 11 posts - 16 through 25 (of 25 total)
You must be logged in to reply to this topic. Login to reply