Author |
Topic |
|
stealthc
Starting Member
21 Posts |
Posted - 02 May 2001 : 12:35:14
|
ok I wanna check and see if anybody can see a problem with this asp script. I've been running into a problem where the server locks up and doesn't run the page properly (although I've had it work a couple of times). My hosting company claims that my index.asp file is corrupt, however, I don't see how this could possibly be the case. So here are the code chunks, tell me if you guys see any problems (I think it may be a problem with the database...but I don't know how that could have possibly occured). Here's the index.asp file
quote:
<% on error resume next Session.LCID = 1033 '## Do Not Edit Response.Buffer = true
dim strDBType, strConnString, strTablePrefix, strMemberTablePrefix, strCookieURL
strDBType = "access"
strConnString = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:\progra~1\vwebsr~1\webroot\news.mdb" '## MS Access 97 strCookieURL = Left(Request.ServerVariables("Path_Info"), InstrRev(Request.ServerVariables("Path_Info"), "/")) set my_Conn = Server.CreateObject("ADODB.Connection") my_Conn.Errors.Clear my_Conn.Open strConnString my_conn.Errors.Clear %>
<!--#INCLUDE FILE="title.asp" --> <!-- Main Page Body --> <table bgcolor='#151515' width="100%" border="0" cellspacing="0" cellpadding="1"> <tr><td VALIGN=TOP> </td><td> </td><td width="100%" VALIGN=TOP> <!-- Begin news generation -->
<% '## Begin code section for Minimizing Categories '## News Code - Minimizing Categories strSql = "Select Max(CAT_ID) as Max_ID " strSql = strSql & " FROM NEWS_CAT"
set rs0 = my_Conn.Execute (strSql) MaxID = rs0("MAX_ID") rs0.close set rs0 = nothing
if MaxID > 0 then i = 1 do until i > cint(MaxID) HideNewsCat = "HideNewsCat" & i if Request.QueryString(HideNewsCat) = "Y" then Response.Cookies(strUniqueID & HideNewsCat) = "Y" Response.Cookies(strUniqueID & HideNewsCat).Expires = now()+365 else if Request.QueryString(HideNewsCat) = "N" then Response.Cookies(strUniqueID & HideNewsCat) = "N" Response.Cookies(strUniqueID & HideNewsCat).Expires = now()+365 end if end if i = i + 1 loop end if scriptname = request.servervariables("script_name") %> <TABLE bgcolor='#202020' width="100%" border="0" cellspacing="0" cellpadding="2"> <!-- Page's table --><TR><TD> <% set strsql = "SELECT NEWS_ENTRY.CAT_ID, NEWS_ENTRY.N_ID, NEWS_ENTRY.N_AUTHOR, NEWS_ENTRY.N_HEADER, NEWS_ENTRY.N_DATE, NEWS_ENTRY.N_MESSAGE, FROM NEWS_ENTRY ORDER BY NEWS_ENTRY.N_ID ASC;" set rsNews = my_Conn.Execute (strsql) '## do until rsNews.EOF Call OpenTable() HideNCat= "HideNewsCat" & rsNews("Cat_ID") if Request.Cookies(strUniqueID & HideNCat) = "Y" then Response.Write"<a href=""" & ScriptName & "?" & HideNCat & "=N""><img src=""icon_plus.gif"" width=""10"" height=""10"" border=""0"" alt=""Expand This Category""></a> " else Response.Write"<a href=""" & ScriptName & "?" & HideNCat & "=Y""><img src=""icon_minus.gif"" width=""10"" height=""10"" border=""0"" alt=""Collapse This Category""></a> " end if Response.Write rsNews("N_HEADER") Call BeforeDate() Response.Write rsNews("N_DATE") Call MailAddy() rsNews.MoveNext '## loop
set i = nothing set rsNews = nothing %>
<!-- Close page's table --></TD></TR></TABLE>
<!-- Subroutine section --> <% Sub OpenTable() %> <TABLE bgcolor='#404050' width="100%" border="0" cellspacing="0" cellpadding="0"> <!-- border table for netscape --><TR><TD> <TABLE bgcolor='#404050' width="100%" border="0" cellspacing="2" cellpadding="0"> <!-- main table --><TR><TD bgcolor="#454560"> <TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> <TR><TD> <font face="Verdana,Arial,Helvetica,sans-serif" size="-1" color="#99AABB"> <B> <% end sub %>
<% Sub BeforeDate() %> </B></TD> <TD><!-- main table title --><font face="Verdana,Arial,Helvetica,sans-serif" size="-1" color="#CCCCDD"> <DIV align="right"><font size="-1" color="#99AABB"> <% end sub %>
<% Sub AfterName() %> </font></A> </TD></TR></TABLE> </TD></TR><TR><TD bgcolor="#505060"> <TABLE width="100% border="0" cellspacing="0" cellpadding="4"><TR><TD> <font face="Verdana,Arial,Helvetica,sans-serif" size="-2" color="#FFDD99"> <% Response.Write rsNews("N_MESSAGE") end sub %>
<% Sub MailAddy() %> <A href=""> <font size="-2" color="#6699DD"> <% HideNCat= "HideNewsCat" & rsNews("Cat_ID") if Request.Cookies(strUniqueID & HideNCat) = "Y" then Call CloseEarly() Call CloseTable() else Call AfterName() Call CloseTable() end if end sub %>
<% Sub CloseEarly() %> </font></A> </TD></TR></TABLE> <% end sub %>
<% Sub CloseTable() %> </TD></TR></TABLE> </TD></TR> <!-- Close border table for netscape --></TD></TR></TABLE> <!-- Close main table --></TD></TR></TABLE> <% end sub %>
<!-- end news generation --> </TD><TD> </TD></TR></TABLE> <!--#INCLUDE FILE="footer.asp" --> </body> </html>
And here's the title.asp file
quote:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Author" content="Ryan Elson"> <title>eXtremely Hostile: Official Website - General News</title> </head> <body text="#FFFFFF" bgcolor="#000000" link="#FFDD99" vlink="#FFDD99" alink="#FFDD99" MARGINHEIGHT="0" TOPMARGIN="0" MARGINWIDTH="0" LEFTMARGIN="0" RIGHTMARGIN="0"> <STYLE> a:link, a:visited, a:active {text-decoration: none} </STYLE> <TABLE width="100%" border="0" cellspacing="0" cellpadding="0"> <TR><TD><IMG SRC="/images/titleback.jpg"></TD> <TD width="100%" background="/images/top_back.jpg"> </TD></TR> </TABLE> <!-- End Title -->
and the footer
quote:
<TABLE width="100%"><TR><TD> <CENTER><font face="Verdana,Arial,Helvetica,sans-serif" size="-2" color="#DDDDDD"><I> This page is subject to the site disclaimers found <A HREF="http://www.extremelyhostile.com/"> <font color="#6699DD">here</font></A>. Site design by <A HREF="mailto:ryane@cgocable.net"><font color="#6699DD">Ryan Elson</font></A>.</I></CENTER> </TD></TR></TABLE>
I don't think there's a problem with the code...but then that leaves only the database, which I created in access 2000 and it should have worked (unless if my copy of access has a problem with it). I just made the NEWS_ENTRY and NEWS_CAT tables as follows: I added fields to the NEWS_ENTRY table, N_ID (autonumber, indexed-no duplicates),CAT_ID (number), N_AUTHOR (number), N_MESSAGE (memo), N_DATE (text:50), N_HEADER (text:75). For the NEWS_CAT table, there were only two fields. CAT_ID (autonumber) and CAT_NAME (text:50). WTF is wrong with this database? Am I missing something cuz it all seems ok... can someone help me figure this all out? icq #22178281 Ryan Elson
I added fields to the
|
|
redbrad0
Advanced Member
USA
3725 Posts |
Posted - 02 May 2001 : 12:45:48
|
what is the url to the page where this script is running?
Brad |
|
|
HuwR
Forum Admin
United Kingdom
20584 Posts |
Posted - 02 May 2001 : 13:26:16
|
a good starting point would be to change this strConnString = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:\progra~1\vwebsr~1\webroot\news.mdb" '## MS Access 97
chnage it to use the Jet4 drivers since you have an access2000 db
|
|
|
stealthc
Starting Member
21 Posts |
Posted - 03 May 2001 : 13:35:06
|
yeah but it still works ok. Actually I figured out the problem, I want to filter database responses with two clauses for the WHERE portion in the sql statement. It seems the server doesn't like that, so instead I need to filter using an if clause after the stuff is retrieved. Actually I got it working and I added some extra stuff, check it out @ www.extremelyhostile.com
|
|
|
|
Topic |
|
|
|