Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

blank ASP page returned

Status
Not open for further replies.

pandapark

Technical User
Jan 29, 2003
92
GB
Hi i've rewritten someones ASP page into a new Application - problem is the page displays absolutely nothing, blank
here is the code
thanks
gareth

<%
ID = Request.QueryString("ID")

Function PressEditDisplay(Params, DBConn, PageID, ParentID, TopID)

Dim b, h

if Request.Form("cmdaction") = "" then

Set objCon = Server.CreateObject("ADODB.Connection")

objCon.CursorLocation = 3
objCon.ConnectionString = "Driver=SQL Server;Server=NAPLES;Database=Press;User ID=aspgen;Password=genasp"
objCon.Open

SQLStr = "Select * From NewStuff Where ID=" & ID & " "
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open SQLStr,objCon,2,4

frmDate = objRS("PressDate")
frmTitle = objRS("Title")
frmLink = objRS("Link")
frmLink = Replace(frmLink, "<br>", vbCrLf )
frmDetails = objRS("Details")
frmDetails = Replace(frmDetails, "<br>", vbCrLf )

objRS.close
Set objRS = Nothing
Set objCon = Nothing

b = "<form ACTION=""main.asp?page=548&ID=" & ID & """ Method=""post"">"
b = b & "<font COLOR=""RED"">" & msg & " "
b = b & "</font><p>"
b = b & "* denotes required field. </p>"
b = b & "<table width=""100%"">"
b = b & "<tr>"
b = b & "<td valign=""top"">*Date:</td>"
b = b & "<td><input type=""text"" name=""frmDate"" value=" & FormatDateTime(frmDate,2) & " size=""15""></td>"
b = b & "</tr>"
b = b & "<tr>"
b = b & "<td valign=""top"">*Title:</td>"
b = b & "<td><input type=""text"" name=""frmTitle"" value=" & frmTitle & " size=""50""></td>"
b = b & "</tr>"
b = b & "<tr>"
b = b & "<td valign=""top"">*Description:</td>"
b = b & "<td><textarea name=""frmDetails"" cols=""70"" rows=""3"">" & frmDetails & "</textarea> </td>"
b = b & "</tr>"
b = b & "<tr>"
b = b & "<td valign=""top"">*Text:</td>"
b = b & "<td><textarea rows=""5"" name=""frmLink"" cols=""70"">" & frmLink & "</textarea></td>"
b = b & "</tr>"
b = b & "<tr>"
b = b & "<td colspan=""2"" align=""center""><input type=""submit"" name=""cmdaction"" value=""UPDATE"">&nbsp;&nbsp<input type=""submit"" name=""cmdaction"" value=""DELETE""></td>"
b = b & "</tr>"

b = b & "</table>"
b = b & "</form>"

b = b & "<p align=""center""><a href=""main.asp?page=549"">Edit an Different Item</a>&nbsp;&nbsp;&nbsp;"
b = b & "<a href=""PressRelease.asp"">Exit Administration</a>&nbsp;&nbsp;&nbsp;<a href=""main.asp?page=545"">Add "
b = b & "a New Item</a></p>"
response.end

elseif Request.Form("cmdaction") = "DELETE" then
Set objCon = Server.CreateObject("ADODB.Connection")

objCon.CursorLocation = 3
objCon.ConnectionString = "Driver=SQL Server;Server=NAPLES;Database=Press;User ID=aspgen;Password=genasp"
objCon.Open
objCon.Execute("delete From Newstuff Where ID=" & ID)
objCon.close
Set objCon = Nothing

response.end

elseif Request.Form("cmdaction") = "UPDATE" then
error = "False"

frmDate = Request.Form("frmDate")
frmTitle = Request.Form("frmTitle")
frmLink = Request.Form("frmLink")
frmDetails = Request.Form("frmDetails")
if Trim(frmTitle) = "" or Trim(frmLink) = "" or Trim(frmDetails) ="" or Trim(frmDate) = "" then
msg = "Fill in all required fields."
error = "true"
end if

if error = "false" then
frmTitle = Replace(frmTitle, Chr(39), "`")
frmLink = Replace(frmLink, Chr(39), "`")
frmLink = Replace(frmLink, vbCrLf, "<br>")
frmDetails = Replace(frmDetails, Chr(39), "`")
frmDetails = Replace(frmDetails, vbCrLf, "<br>")

Set objCon = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")

objCon.CursorLocation = 3
objCon.ConnectionString = "Driver=SQL Server;Server=NAPLES;Database=Press;User ID=aspgen;Password=genasp"
objCon.Open
error = "false"
frmDate = Request.Form("frmDate")
frmTitle = Request.Form("frmTitle")
frmLink = Request.Form("frmLink")
frmDetails = Request.Form("frmDetails")

SQLstmt = "UPDATE NewStuff SET "
SQLstmt = SQLstmt & " PressDate='" & TRIM(Request.Form("frmDate")) & "', "
SQLstmt = SQLstmt & " Title ='" & TRIM(Request.Form("frmTitle ")) & "', "
SQLstmt = SQLstmt & " Link='" & TRIM(Request.Form("frmLink")) & "', "
SQLstmt = SQLstmt & " Details='" & TRIM(Request.Form("frmDetails")) & "'"
SQLstmt = SQLstmt & " WHERE ID =" & TRIM(Request.Form("ID"))
response.write SQLstmt
objRS.Open SQLStr,objCon,1,2

objCon.execute(SQLstmt)
Response.Write "Operation Complete<BR> <A HREF=""main.asp?page=545"">Home</A>"

response.end
end if
end if

objRS.Close
objCon.Close
Set objRS = Nothing
Set objCon = Nothing

objBODY = b
objHEAD = ""
objONLOAD = ""
objONRESIZE = ""
objONUNLOAD = ""

PressEditDisplay = True

End Function

Function PressEditIsSupported(Params, DBConn, PageID, ParentID, TopID, PublishType)
' We may need to do some database lookups to work out if the page can be
' published in a particular way
select case UCase(PublishType)
case "HTM"
PressEditIsSupported = True
case "ASP"
PressEditIsSupported = True
case else
PressEditIsSupported = True
end select
End Function

Function PressEditPublish(Params, DBConn, PageID, ParentID, TopID, PublishType)
PressEditPublish = PressEditDisplay(Params, DBConn, PageID, ParentID, TopID)
End Function

%>
 
Hi Chris

This page itself - the page it comes from is fine and even on this page i can response.write the ID and it returns the value
 
the code posted above doesn't do anything apart from set a variable value and define three functions.

What were you expecting to see?

Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Right, since your not calling any of the functions the page is basically executing the following code:
Code:
<%
ID = Request.QueryString("ID")
[s]
Function PressEditDisplay(Params, DBConn, PageID, ParentID, TopID)

Dim b, h

    if Request.Form("cmdaction") = "" then

    Set objCon = Server.CreateObject("ADODB.Connection")

    objCon.CursorLocation = 3
    objCon.ConnectionString = "Driver=SQL Server;Server=NAPLES;Database=Press;User ID=aspgen;Password=genasp"
    objCon.Open

    SQLStr = "Select * From NewStuff Where ID=" & ID & " "
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open SQLStr,objCon,2,4

    frmDate = objRS("PressDate")
    frmTitle = objRS("Title")
    frmLink = objRS("Link")
    frmLink = Replace(frmLink, "<br>", vbCrLf )
    frmDetails = objRS("Details")
    frmDetails = Replace(frmDetails, "<br>", vbCrLf )

    objRS.close
    Set objRS = Nothing
    Set objCon = Nothing

    b = "<form ACTION=""main.asp?page=548&ID=" & ID & """ Method=""post"">"
    b = b & "<font COLOR=""RED"">" & msg & " "
    b = b & "</font><p>"
    b = b & "* denotes required field. </p>"
    b = b & "<table width=""100%"">"
    b = b & "<tr>"
    b = b & "<td valign=""top"">*Date:</td>"
    b = b & "<td><input type=""text"" name=""frmDate"" value=" & FormatDateTime(frmDate,2) & " size=""15""></td>"
    b = b & "</tr>"
    b = b & "<tr>"
    b = b & "<td valign=""top"">*Title:</td>"
    b = b & "<td><input type=""text"" name=""frmTitle"" value=" & frmTitle & " size=""50""></td>"
    b = b & "</tr>"
    b = b & "<tr>"
    b = b & "<td valign=""top"">*Description:</td>"
    b = b & "<td><textarea name=""frmDetails"" cols=""70"" rows=""3"">" & frmDetails & "</textarea> </td>"
    b = b & "</tr>"
    b = b & "<tr>"
    b = b & "<td valign=""top"">*Text:</td>"
    b = b & "<td><textarea rows=""5"" name=""frmLink"" cols=""70"">" & frmLink & "</textarea></td>"
    b = b & "</tr>"
    b = b & "<tr>"
    b = b & "<td colspan=""2"" align=""center""><input type=""submit"" name=""cmdaction"" value=""UPDATE"">&nbsp;&nbsp<input type=""submit"" name=""cmdaction"" value=""DELETE""></td>"
    b = b & "</tr>"

    b = b & "</table>"
    b = b & "</form>"

    b = b & "<p align=""center""><a href=""main.asp?page=549"">Edit an Different Item</a>&nbsp;&nbsp;&nbsp;"
    b = b & "<a href=""PressRelease.asp"">Exit Administration</a>&nbsp;&nbsp;&nbsp;<a href=""main.asp?page=545"">Add "
    b = b & "a New Item</a></p>"
    response.end

elseif Request.Form("cmdaction") = "DELETE" then
    Set objCon = Server.CreateObject("ADODB.Connection")

    objCon.CursorLocation = 3
    objCon.ConnectionString = "Driver=SQL Server;Server=NAPLES;Database=Press;User ID=aspgen;Password=genasp"
    objCon.Open
    objCon.Execute("delete From Newstuff Where ID=" & ID)
    objCon.close
    Set objCon = Nothing

    response.end

elseif Request.Form("cmdaction") = "UPDATE" then
    error = "False"

    frmDate = Request.Form("frmDate")
    frmTitle = Request.Form("frmTitle")
    frmLink = Request.Form("frmLink")
    frmDetails = Request.Form("frmDetails")
    if Trim(frmTitle) = "" or Trim(frmLink) = "" or Trim(frmDetails) ="" or Trim(frmDate) = "" then
    msg = "Fill in all required fields."
    error = "true"
    end if

    if error = "false" then
    frmTitle = Replace(frmTitle, Chr(39), "`")
    frmLink = Replace(frmLink, Chr(39), "`")
    frmLink = Replace(frmLink, vbCrLf, "<br>")
    frmDetails = Replace(frmDetails, Chr(39), "`")
    frmDetails = Replace(frmDetails, vbCrLf, "<br>")

    Set objCon = Server.CreateObject("ADODB.Connection")
    Set objRS = Server.CreateObject("ADODB.Recordset")

    objCon.CursorLocation = 3
    objCon.ConnectionString = "Driver=SQL Server;Server=NAPLES;Database=Press;User ID=aspgen;Password=genasp"
    objCon.Open
     error = "false"
    frmDate = Request.Form("frmDate")
    frmTitle = Request.Form("frmTitle")
    frmLink = Request.Form("frmLink")
    frmDetails = Request.Form("frmDetails")

    SQLstmt = "UPDATE NewStuff SET "
    SQLstmt = SQLstmt & " PressDate='" & TRIM(Request.Form("frmDate")) & "', "
    SQLstmt = SQLstmt & " Title ='" & TRIM(Request.Form("frmTitle ")) & "', "
    SQLstmt = SQLstmt & " Link='" & TRIM(Request.Form("frmLink")) & "', "
    SQLstmt = SQLstmt & " Details='" & TRIM(Request.Form("frmDetails")) & "'"
    SQLstmt = SQLstmt & " WHERE ID =" & TRIM(Request.Form("ID"))      
    response.write SQLstmt
    objRS.Open SQLStr,objCon,1,2

    objCon.execute(SQLstmt)
    Response.Write "Operation Complete<BR> <A  HREF=""main.asp?page=545"">Home</A>"

    response.end
end if
end if

    objRS.Close
    objCon.Close
    Set objRS = Nothing
    Set objCon = Nothing

    objBODY     = b
    objHEAD     = ""
    objONLOAD   = ""
    objONRESIZE = ""
    objONUNLOAD = ""
    
    PressEditDisplay = True

End Function

Function PressEditIsSupported(Params, DBConn, PageID, ParentID, TopID, PublishType)
    ' We may need to do some database lookups to work out if the page can be
    ' published in a particular way
    select case UCase(PublishType)
        case "HTM"
            PressEditIsSupported = True
        case "ASP"
            PressEditIsSupported = True
        case else
            PressEditIsSupported = True
    end select
End Function

Function PressEditPublish(Params, DBConn, PageID, ParentID, TopID, PublishType)
    PressEditPublish = PressEditDisplay(Params, DBConn, PageID, ParentID, TopID)
End Function
[/s]
%>

:) Try calling the functions at soem point, you should get more output

-T

01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
The never-completed website:
 
sorry my fault

The Application we have is where you would create the page -you then call the plugin i.e. PressEdit from there - i've got lots of similar pages like this that work but I've inherited this one but to my beginners eyes it looks ok
 
and i searched your code for .write the only things you're "outputting" is your sqlstmt and "Operation Complete<BR> <A HREF=""main.asp?page=545"">Home</A>"


but i dont even think you're making it to those lines via failure to call functions

[thumbsup2]DreX
aKa - Robert
 
thanks anyway everybody - its working ok now despite the fact I've done nothing...........the wonders of technology !

gareth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top