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"">  <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> "
b = b & "<a href=""PressRelease.asp"">Exit Administration</a> <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
%>
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"">  <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> "
b = b & "<a href=""PressRelease.asp"">Exit Administration</a> <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
%>