Author |
Topic |
|
rsoxhater
Junior Member
120 Posts |
Posted - 02 April 2003 : 11:20:55
|
Does this code for the birthday mod close the database connection string? I'm trying to figure out why our site is taking up so much on our hosting company's SQL Server. This is a copy of the birthday mod I installed a couple weeks ago.
Thanks guys ----------------------
<% HideComp = "HideComp" If Request.QueryString(HideComp) = "Y" then Response.Cookies(strUniqueID & HideComp) = "Y" Response.Cookies(strUniqueID & HideComp).Expires = dateAdd("d", 30, strForumTimeAdjust) Else If Request.QueryString(HideComp) = "N" then Response.Cookies(strUniqueID & HideComp) = "N" Response.Cookies(strUniqueID & HideComp).Expires = dateAdd("d", 30, strForumTimeAdjust) End If End If %> <tr><td bgcolor="<% =strCategoryCellColor %>" colspan="<% if (strShowModerators = "1") or (mlev = 4 or mlev = 3) then Response.Write("7") else Response.Write("5")%>"> <% ' This code will specify whether or not to show the forums under a category HideComp = "HideComp" If Request.Cookies(strUniqueID & HideComp) = "Y" then %> <a href="<% =ScriptName & "?" %><% =HideComp & "=N" %>"><img src="icon_plus.gif" width="10" height="10" border="0" alt="Expand Birthday"></a> <% Else %> <a href="<% =ScriptName & "?" %><% =HideComp & "=Y" %>"><img src="icon_minus.gif" width="10" height="10" border="0" alt="Collapse Birthday"></a> <% End If %><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" size="+1"> <b>Birthdays</b></font> </td> </tr> <% if Request.Cookies(strUniqueID & HideComp) <> "Y" then %> <tr><td align="center" bgcolor="<% =strForumCellColor %>" valign="middle"><IMG SRC="icon_comp.gif" border="0"></td> <td valign=top bgcolor="<% =strForumCellColor %>" colspan="<% if (strShowModerators = "1") or (mlev = 4 or mlev = 3) then Response.Write("7") else Response.Write("5")%>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strLinkColor %>" size="+1"><B> Wish a Happy Birthday to:</B></FONT><BR> <% MaxOnlineDisplay = strPageSize if MaxOnlineDisplay = "" then MaxOnlineDisplay = 15 end if set rsbirth = Server.CreateObject("ADODB.Recordset") oggi=Now() mese=Month(oggi) If Len(mese)=1 Then mese="0" & mese End If giorno=Day(oggi) If Len(giorno)=1 Then giorno="0" & giorno End If anno=Year(oggi) oggi=mese & giorno If Len(anno)=1 Then anno="200" & anno ElseIf Len(anno)=2 Then anno="20" & anno ElseIf Len(anno)=3 Then anno="2" & anno End If '## Forum_SQL strSql ="SELECT " & strTablePrefix & "MEMBERS.M_DOB," & strTablePrefix & "MEMBERS.M_NAME," & strTablePrefix & "MEMBERS.MEMBER_ID FROM " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " WHERE " & strTablePrefix & "MEMBERS.M_DOB LIKE '%" & oggi & "' ORDER BY " & strTablePrefix & "MEMBERS.M_NAME DESC" rsbirth.open strSql, my_Conn, 3 %> <font face="<% =strDefaultFontFace %>" size="<% =strFooterFontSize %>" color="<% =strForumLinkFontColor %>"> <% c=0 If rsbirth.EOF or rsbirth.BOF then Response.Write "" Else rsbirth.movefirst do until rsbirth.EOF yearbirth=Left(rsbirth("M_DOB"),4) eta=Int(anno)-yearbirth If c>0 Then Response.Write ", " End If if strUseExtendedProfile then Response.Write ("<a href=""pop_profile.asp?mode=display&id="& rsbirth("MEMBER_ID") & """>" & rsbirth("M_NAME") & "</a> (" & eta & ")") else Response.Write ("<a href=""JavaScript:openWindow2('pop_profile.asp?mode=display&id=" & rsbirth("MEMBER_ID") & "')"">" & rsbirth("M_NAME") & "</a> (" & eta & ")") end if c=1 rsbirth.MoveNext loop end if %> </font></td></tr> <% end if %> |
Edited by - ruirib on 02 April 2003 11:22:28 |
|
Hamlin
Advanced Member
United Kingdom
2386 Posts |
Posted - 02 April 2003 : 11:34:53
|
At first glance I can not see any sign of...
rsbirth.close
set rsbirth = nothing
Its not closing the record set it as opened, the my_Conn connection will get cleaned up by the snitz code. |
|
|
rsoxhater
Junior Member
120 Posts |
Posted - 02 April 2003 : 11:35:44
|
Where would I put that in the code hamlin? |
|
|
Kat
Advanced Member
United Kingdom
3065 Posts |
Posted - 02 April 2003 : 11:36:55
|
I can't see where it closes and discards the recordset in that code. Are you sure there is no more code? I don't use that mod myself.
I would expect to see
rsbirth.close
set rsbirth = nothing somewhere |
KatsKorner
Installation Help | Snitz Mods | Forum Hosting
|
|
|
Kat
Advanced Member
United Kingdom
3065 Posts |
|
rsoxhater
Junior Member
120 Posts |
Posted - 02 April 2003 : 11:37:44
|
nope, thats the entire include file Kat |
|
|
rsoxhater
Junior Member
120 Posts |
Posted - 02 April 2003 : 11:38:54
|
<% end if
rsbirth.close set rsbirth = nothing %>
Like that? |
|
|
Hamlin
Advanced Member
United Kingdom
2386 Posts |
Posted - 02 April 2003 : 11:39:38
|
quote: Originally posted by rsoxhater
Where would I put that in the code hamlin?
There are too many if's all over the place, its hard to tell whens it not spaced out neatly I would shove it here though, with the last end if
<%
rsbirth.close
set rsbirth = nothing
end if %>
|
|
|
rsoxhater
Junior Member
120 Posts |
Posted - 02 April 2003 : 11:40:01
|
Or like this? <% end if %> <% rsbirth.close set rsbirth = nothing %>
|
|
|
Kat
Advanced Member
United Kingdom
3065 Posts |
|
rsoxhater
Junior Member
120 Posts |
Posted - 02 April 2003 : 11:41:48
|
Thanks for the help guys - i will use hamlins code on the end of it - thank you very much for the quick help guys |
|
|
Hamlin
Advanced Member
United Kingdom
2386 Posts |
Posted - 02 April 2003 : 11:42:34
|
quote: Originally posted by rsoxhater
Or like this? <% end if %> <% rsbirth.close set rsbirth = nothing %>
If you do it that way you may get errors, the last end if statement seems to match this if...
if Request.Cookies(strUniqueID & HideComp) <> "Y" then So the record set IMO should go inside the last end if, because it will not always be opened. |
|
|
Hamlin
Advanced Member
United Kingdom
2386 Posts |
Posted - 02 April 2003 : 11:43:57
|
quote: Originally posted by rsoxhater
Thanks for the help guys - i will use hamlins code on the end of it - thank you very much for the quick help guys
Glad we could help. |
|
|
rsoxhater
Junior Member
120 Posts |
Posted - 02 April 2003 : 11:47:17
|
Thats why I swear by snitz forums, becuase of the help I get here |
|
|
Kat
Advanced Member
United Kingdom
3065 Posts |
|
|
Topic |
|