Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
huge
Starting Member
31 Posts |
Posted - 2002-04-05 : 15:05:54
|
| Hey I have a page that is actually quite simple compared to other pages on my site. All it does is log the user in if he is not already logged in (include). It then grabs his username from his login, and then executes a stored_procedure that retrieves from the database all his buddies. The stored procedure is in a join with another table in the DB so basically it looks like this:------------------------table list_buddy_ignore------------------------ListIDUsernameUserUsernameListBuddy_Ignore (if it his buddy then 1 if ignored then 2)DateCreatedThe table above is in a Inner Join with this table:------------------------table User_Login------------------------UserIDUsernameDateactivatedSo I have a Inner join with UsernameList and Username. This works nice and fast and well in QA but as soon as I try to load the ASP page that runs this sproc then my page times out. What the heck is wrong? How are these time-outs avoided in ASP? The info is supposed to be put into a nicely formatted table from the asp page. I have done this millions of times on other ASP pages why is this one tempermental? Here is the main code from my asp:<%'-----------------------------------------------------'|||||||| Declare and Assign variables ||||||||||'-----------------------------------------------------username = username_user 'The username of the logged in user'-----------------------------------------------------'|||||||| show buddy and ignore list ||||||||||'----------------------------------------------------- Set Conn = Server.CreateObject("ADODB.connection") conn.open "DSN=AdultMatch; uid=mikem; pwd=mikem" mySQL = "Execute sproc_buddy_Ignore_List '" & username & "'" Set ORs = Conn.Execute(mySQL) %><table cellpadding=3 cellspacing=3 border=0 width="100%" align="center"> <tr bgcolor="#80AECD"> <td align=left bgcolor="#80AECD"> ... <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFCC33">... </table> <table width="100%" border="0" cellspacing="0" cellpadding="4"> <tr> <td width="50%"> <form name="List" method="post" action="deletebuddy.asp?SID=<%=SID %>"> <% numbuddies = 0 WHILE NOT Ors.EOF If CINT(Ors("buddy_Ignore")) = 1 Then numbuddies = numbuddies + 1 oRs.MoveNext End if WEND Response.write "You Currently have " & numbuddies & " buddies on your list"%> <input type="hidden" name="numbuddies" value="<%=numbuddies %>"> <table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFCC33">... <tr bgcolor="#FFCC33"> <td width="10%"> <div align="center"><font size="2" color="#666666"><b>Delete</b></font></div> </td> <td width="45%"> <div align="center"><font size="2" color="#666666"><b>Username - UserID</b></font></div> </td> <td width="20%"> <div align="center"><font size="2" color="#666666"><b>Send Message</b></font></div> </td> </tr> </table> <table width="100%" border="0" cellspacing="1" cellpadding="0"> <% ORs.Movefirst WHILE NOT Ors.EOF If CINT(Ors("buddy_Ignore")) = 1 Then i = i+1 %> <tr bgcolor="#FFCC33"> <td width="10%"> <div align="center"> <input type="checkbox" name="chk_<%=i%>" value="<%=ORs("listID")%>"> </div> </td> <td width="45%"><font face="MS Sans Serif" size=2><%=ORs("UsernameList")%></font></td> <td width="20%"> <div align="center"><a href="../Messaging/Sendmessage.asp?SID=<%=SID%>&UID=<%=Ors("Userid")%>">Click Here</a></div> </td> </tr> <% End if oRs.MoveNext WEND Set Ors = Nothing conn.close%> </table> ... </div> </td> </tr> </table> </form> </td></table>---------------------------------------------------------------I have omitted some needless HTML from the code, so bear with the HTML that is still there, just check out the ASP. I dont believe there is anything wrong cause I have done this many times before.Thanks for all your helpHuGE |
|
|
Jay99
468 Posts |
Posted - 2002-04-05 : 15:38:54
|
quote: WHILE NOT Ors.EOF If CINT(Ors("buddy_Ignore")) = 1 Then numbuddies = numbuddies + 1 oRs.MoveNext End if WEND
so if ors("buddy_Ignore") is not 1, you don't move to the next record . . . infinate loop. (Move your End if up one line)Jay<O>EDIT: got you in the sights of my sniper rifle SetBased!!Edited by - Jay99 on 04/05/2002 15:40:13 |
 |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-04-05 : 15:39:21
|
It would seem you have a logic error in the script:quote: WHILE NOT Ors.EOFIf CINT(Ors("buddy_Ignore")) = 1 Then numbuddies = numbuddies + 1 oRs.MoveNextEnd ifWEND
the MoveNext() call is inside the if statement.setBasedIsTheTruepath<O> |
 |
|
|
huge
Starting Member
31 Posts |
Posted - 2002-04-05 : 17:57:45
|
| thanks alot that worked great now my page is stylin'.lolThanks again my eyes go blurry on fridayHuGE |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-04-05 : 18:17:31
|
| It's not your eyes; the MoveNext() method is NOTORIOUS for jumping out of line and even running completely away from your code. This goes back to the good ol' Data Access Objects (DAO) days! Once you type in MoveNext(), you have to nail it in place or it'll disappear!Stoooooooooopid MoveNext gremlins keep knocking it outta my code, I hate 'em! |
 |
|
|
|
|
|