Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 is this code ok?
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

rsoxhater
Junior Member

120 Posts

Posted - 02 April 2003 :  11:20:55  Show Profile
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  Show Profile
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.
Go to Top of Page

rsoxhater
Junior Member

120 Posts

Posted - 02 April 2003 :  11:35:44  Show Profile
Where would I put that in the code hamlin?
Go to Top of Page

Kat
Advanced Member

United Kingdom
3065 Posts

Posted - 02 April 2003 :  11:36:55  Show Profile  Visit Kat's Homepage
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
Go to Top of Page

Kat
Advanced Member

United Kingdom
3065 Posts

Posted - 02 April 2003 :  11:37:39  Show Profile  Visit Kat's Homepage
straight after that last <%end if%> between <% %> tags.

KatsKorner

Installation Help | Snitz Mods | Forum Hosting
Go to Top of Page

rsoxhater
Junior Member

120 Posts

Posted - 02 April 2003 :  11:37:44  Show Profile
nope, thats the entire include file Kat
Go to Top of Page

rsoxhater
Junior Member

120 Posts

Posted - 02 April 2003 :  11:38:54  Show Profile
<% end if

rsbirth.close
set rsbirth = nothing
%>

Like that?
Go to Top of Page

Hamlin
Advanced Member

United Kingdom
2386 Posts

Posted - 02 April 2003 :  11:39:38  Show Profile
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 %>
Go to Top of Page

rsoxhater
Junior Member

120 Posts

Posted - 02 April 2003 :  11:40:01  Show Profile
Or like this?
<% end if %>
<% rsbirth.close
set rsbirth = nothing
%>
Go to Top of Page

Kat
Advanced Member

United Kingdom
3065 Posts

Posted - 02 April 2003 :  11:40:05  Show Profile  Visit Kat's Homepage
yep me too. Then you know it is finished.

KatsKorner

Installation Help | Snitz Mods | Forum Hosting
Go to Top of Page

rsoxhater
Junior Member

120 Posts

Posted - 02 April 2003 :  11:41:48  Show Profile
Thanks for the help guys - i will use hamlins code on the end of it - thank you very much for the quick help guys
Go to Top of Page

Hamlin
Advanced Member

United Kingdom
2386 Posts

Posted - 02 April 2003 :  11:42:34  Show Profile
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.
Go to Top of Page

Hamlin
Advanced Member

United Kingdom
2386 Posts

Posted - 02 April 2003 :  11:43:57  Show Profile
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.
Go to Top of Page

rsoxhater
Junior Member

120 Posts

Posted - 02 April 2003 :  11:47:17  Show Profile
Thats why I swear by snitz forums, becuase of the help I get here
Go to Top of Page

Kat
Advanced Member

United Kingdom
3065 Posts

Posted - 02 April 2003 :  12:03:32  Show Profile  Visit Kat's Homepage
I meant Hamlins way - just looked back at the flow of the thread. Glad you are sorted rsoxhater!

KatsKorner

Installation Help | Snitz Mods | Forum Hosting
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.31 seconds. Powered By: Snitz Forums 2000 Version 3.4.07