here is code to a application a buddy wrote and I am new to VB script. I need to add a pop up on the delete press release icon. If anybody could help i would greatly appreciate it. It is highlighted in purple.
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Script Name: PRAttachAdmin.asp '
' '
' Description: Page to add or delete press releases attachmentx '
' '
' ---------------------------------------------------------------------------- '
' '
' Change Log: '
' '
' Developer Date Changes '
' ------------ ---------- -------------------------------------------------- '
' '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Response.Buffer = True
%>
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Script Name: PRAttachAdmin.asp '
' '
' Description: Tool to administer ETP press release attachments '
' '
' ---------------------------------------------------------------------------- '
' '
' Change Log: '
' '
' Developer Date Changes '
' ------------ ---------- -------------------------------------------------- '
' '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error Resume Next
%>
<!-- #include file="inc/ETPRoutines.asp" -->
<!--#INCLUDE FILE="inc/clsUpload.asp"-->
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Global Variables '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim IdCompany, AppFunction, boolDebug, intOffsetRow, strOrderBy, strScriptName
Dim objConn, objRS, strSQL
Const MAX_ROWS = 10
IdCompany = Request( "idCompany" )
AppFunction = Request( "AppFunction" )
boolDebug = False
strScriptName = GetScriptName()
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' The statement below grabs the total number of rows every time the session '
' expires, or when the session has initially begun. This allows the page '
' numbering routine to work properly. '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If IsEmpty( Session( strScriptName & "_TotalRows" ) ) Then
Session( strScriptName & "_TotalRows" ) = GetTotalRows( "Attachment" )
End If
Call Header( "Press Release Attachment Maintenance" )
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Main Table '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "<table cellpadding=0 cellspacing=0 class=maintable align=center>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<td>" & VBCR )
Call LogoBreadNav
Call NavBar
Response.Write( "<table cellpadding=0 cellspacing=0 border=0>" & VBCR )
Response.Write( "<col width=130>" & VBCR )
Response.Write( "<col width=*>" & VBCR )
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Left Sidebar / Secondary Navigation '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "<tr valign=top>" & VBCR )
Response.Write( "<td class=nav2>" & VBCR )
Response.Write( "</td>" & VBCR )
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Main Content '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "<td class=maintext1>" & VBCR )
Response.Write( "<br><br>")
If Session("bolAuthenticated") = true and Session( "App" )="PRMaintain" Then
Select Case UCase( AppFunction )
Case "ADD ATTACHMENT"
Session("strIdPressRelease")=Request.QueryString( "idPressRelease" )
InsertForm()
Case "SUBMIT"
ConfirmAttachment(Request.QueryString( "filename" ))
Case "CONFIRM"
InsertAttachment()
Session( "AT_TotalRows" ) = GetTotalRows( "pressrelease" )
DisplayRecords(Session("strIdPressRelease"))
'Session("strIdPressRelease")=""
Case "UPDATEFORM"
UpdateForm()
Case "DELETERECORD"
DeleteRecord()
DisplayRecords(Session("strIdPressRelease"))
Case "LIST ATTACHMENTS"
Session( "AT_TotalRows" ) = GetTotalRows( "pressrelease" )
DisplayRecords(Request.QueryString( "idPressRelease" ))
CASE "DISPLAY RELATED ATTACHMENT"
DisplayRecords(Request.QueryString( "idPressRelease" ))
Session("strIdPressRelease")=Request.QueryString( "idPressRelease" )
Case Else
DisplayRecords(Session("strIdPressRelease"))
End Select
else
Response.Redirect "Password2.asp?" & Server.URLEncode(Request.ServerVariables("SCRIPT_NAME"))
end if
Response.Write( "</div>" & VBCR )
Response.Write( "</td>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "</table>" & VBCR )
Call TextNav
Response.Write( "</td>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "</table>" & VBCR )
Call Footer
DebugScript( boolDebug )
Function DisplayRecords(idPressRelease)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Determine OffsetRow value '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If Request.Form( "OffsetRow" ) = "" Then
intOffsetRow = 0
Else
intOffsetRow = Request.Form( "OffsetRow" )
End If
If AppFunction = "NEXT" Then
intOffsetRow = Request.Form( "PrevOffsetRow" ) + MAX_ROWS
ElseIf AppFunction = "PREV" Then
intOffsetRow = Request.Form( "PrevOffsetRow" ) - MAX_ROWS
ElseIf AppFunction = "FIRST" Then
intOffsetRow = 0
ElseIf AppFunction = "LAST" Then
intOffsetRow = GetLastOffset( Session( strScriptName & "_TotalRows" ) )
ElseIf Request.Form( "JUMP" ) <> "" Then
intOffsetRow = ( Request.Form( "JUMP" ) - 1 ) * MAX_ROWS
End If
Response.Write( "<form action=" & strScriptName & " method=post>" & VBCR )
Response.Write( "<table class=ts1>" & VBCR )
Response.Write( "<col width=50>" & VBCR )
Response.Write( "<col width=*>" & VBCR )
Response.Write( "<col width=*>" & VBCR )
Response.Write( "<col width=70>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th class=hdg1 colspan=4>PRESS RELEASE ATTACHMENTS</th>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th><a href=?AppFunction=ToggleSort&OrderField=idAttachment>ID</a></th>" & VBCR )
Response.Write( "<th><a href=?AppFunction=ToggleSort&OrderField=FileDescription>File Description</a></th>" & VBCR )
Response.Write( "<th><a href=?AppFunction=ToggleSort&OrderField=FileName>File name</a></th>" & VBCR )
Response.Write( "<th><a href=?AppFunction=ToggleSort&OrderField=ICOidIcon>File Type</a></th>" & VBCR )
Response.Write( "</tr>" & VBCR )
Set objConn = Server.CreateObject( "ADODB.Connection" )
Set objRS = Server.CreateObject( "ADODB.Recordset" )
objConn.Open = strDBConnection
If Err.Number <> 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB Failure Error Trap '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "DB Connection Error DisplayRecords" )
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Assign default sort order '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If IsEmpty( Session( strScriptName & "_OrderField" ) ) Then
Session( strScriptName & "_OrderField" ) = "FileDescription"
Session( strScriptName & "_OrderDirection" ) = "DESC"
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Assign sort order if any of the headings are selected '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If AppFunction = "ToggleSort" Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' If the current order field and the requested order field are equal, '
' then simply switch the direction of the sort. Otherwise, assign '
' the new order field and default the direction to ascending '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
If UCase(Session( strScriptName & "_OrderField" ) ) = UCase( Request.QueryString( "OrderField" ) ) Then
If Session( strScriptName & "_OrderDirection" ) = "ASC" Then
Session( strScriptName & "_OrderDirection" ) = "DESC"
Else
Session( strScriptName & "_OrderDirection" ) = "ASC"
End If
Else
Session( strScriptName & "_OrderField" ) = Request.QueryString( "OrderField" )
Session( strScriptName & "_OrderDirection" ) = "ASC"
End If
End If
if (idPressRelease <> "" ) Then
strSQL = "SELECT AT.idAttachment, AT.FileDescription, AT.FilePath, AT.FileName, ICO.FilePath, ICO.Filename AS ICOFilename, ICO.idIcon AS ICOIdIcon FROM pr_attach_xref p, attachment AT, icon ICO WHERE p.idPressRelease= " & idPressRelease & " and AT.idAttachment=p.idAttachment and ICO.idIcon=AT.idICon; "
Else
strSQL = "SELECT AT.idAttachment, AT.FileDescription, AT.FilePath, AT.FileName, ICO.FilePath, ICO.Filename AS ICOFilename, ICO.idIcon AS ICOIdIcon " _
& "FROM attachment AS AT " _
& "LEFT OUTER JOIN ICON AS ICO " _
& "ON AT.idIcon = ICO.idIcon " _
& "ORDER BY " & Session( strScriptName & "_OrderField" ) & " " & Session( strScriptName & "_OrderDirection" ) & " " _
& "LIMIT " & intOffsetRow & ", " & MAX_ROWS
end if
Set objRS = objConn.Execute( strSQL )
If Not objRS.BOF AND Not objRS.EOF Then
While Not objRS.EOF
Response.Write( "<tr height=40>" & VBCR )
Response.Write( "<td>" & VBCR )
' Response.Write( "<a href=?AppFunction=UpdateForm&idAttachment=" & objRS( "idAttachment" ) & "><img src=gfx/icon_edit1.gif border=0></a>" & VBCR )
Response.Write( "<a href=?AppFunction=DeleteRecord&idAttachment=" & objRS( "idAttachment" ) & "><img src=gfx/icon_delete1.gif border=0></a>" & VBCR )
Response.Write( "</td>" & VBCR )
Response.Write( "<td>" & objRS( "FileDescription" ) & "</td>" & VBCR )
Response.Write( "<td>" & objRS( "FileName" ) & "</td>" & VBCR )
Response.Write( "<td align=right><img src=" & objRS( "FilePath" ) & objRS( "ICOFilename" ) & "></td>" & VBCR )
Response.Write( "</tr>" & VBCR )
objRS.MoveNext
WEnd
CloseAll()
StatusBar()
else
Response.Write( "<tr height=40>" & VBCR )
Response.Write( "<td colspan=4>There are no files attached to Press Release number " & idPressRelease & ".</td>" & VBCR )
Response.Write( "</tr>" & VBCR )
end if
Response.Write( "</table>" & VBCR )
Response.Write( "<input type=hidden name=PrevOffsetRow value=" & intOffsetRow & ">" & VBCR )
Response.Write( "</form>" & VBCR )
End Function
Public Function UpdateForm()
Response.Write( "<table class=ts1>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th class=hdg1 colspan=2>Press Release Attachment Maintenance</th>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "<form action=" & Request.ServerVariables( "SCRIPT_NAME" ) & " method=post>" & VBCR )
Set objConn = Server.CreateObject( "ADODB.Connection" )
Set objRS = Server.CreateObject( "ADODB.Recordset" )
objConn.Open = strDBConnection
If Err.Number <> 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB Failure Error Trap '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "DB Connection Error UpdateForm" )
End If
strSQL = "SELECT PR.Visible, PR.idPressRelease, PR.Headline, PR.SubHeadline, PR.DateStamp, PR.idDateline, PR.Body, PR.idBoilerplate " _
& "FROM pressrelease AS PR " _
& "WHERE PR.idpressrelease = " & Request.QueryString( "idPressRelease" )
Set objRS = objConn.Execute( strSQL )
If Not objRS.BOF AND Not objRS.EOF Then
Response.Write( "<tr>" & VBCR )
Response.Write( "<th><b>VISIBLE</b></th>" & VBCR )
Response.Write( "<th><b>PRESS RELEASE ID</b></th>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "<th>" & VBCR )
Select Case objRS( "Visible")
Case 0
Response.Write( "<input type=radio name=visible value=1>Visible<br>" & VBCR )
Response.Write( "<input type=radio name=visible value=0 checked>Not Visible" & VBCR )
Case 1
Response.Write( "<input type=radio name=visible value=1 checked>Visible<br>" & VBCR )
Response.Write( "<input type=radio name=visible value=0>Not Visible" & VBCR )
Case Else
Response.Write( "<input type=radio name=visible value=1>Visible<br>" & VBCR )
Response.Write( "<input type=radio name=visible value=0 checked>Not Visible" & VBCR )
End Select
Response.Write( "</th>" & VBCR )
Response.Write( "<th><input type=text name=idPressRelease size=5 value=" & objRS( "idPressRelease" ) & " ReadOnly></th>" & VBCR )
Response.write( "</tr>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th colspan=2><br><b>HEADLINE</b></th>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th colspan=2><input type=text name=Headline size=130 value='" & objRS( "Headline") & "'></th>" & VBCR )
Response.write( "</tr>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th colspan=2><br><b>SUB HEADLINE</b></th>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "<th colspan=2><input type=text name=SubHeadline size=130 value='" & objRS( "SubHeadline") & "'></th>" & VBCR )
Response.write( "</tr>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th><br><b>DATELINE</b></th><th><br><b>DATE STAMP</b></th>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "<th>" & VBCR )
Response.Write( "<select name=idDateline>" & VBCR )
ListDatelines( objRS( "idDateline" ) )
Response.Write( "</select>" & VBCR )
Response.Write( "</th>" & VBCR )
Response.Write( "<th><input type=text name=DateStamp size=15 value='" & objRS( "DateStamp" ) & "'></th>" & VBCR )
Response.write( "</tr>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th colspan=2><br><b>PRESS RELEASE BODY</b></th>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th colspan=2><textarea name=Body rows=20 cols=115>" & objRS( "Body") & "</textarea></th>" & VBCR )
Response.write( "</tr>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th colspan=2><br><b>BOILERPLATE</b></th>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "</tr>" & VBCR )
'Response.Write( "<th colspan=2><input type=text name=idBoilerplate size=15 value=" & objRS( "idBoilerplate") & "></th>" & VBCR )
Response.Write( "<th colspan=2>" & VBCR )
ListBoilerplates( objRS( "idBoilerplate" ) )
Response.Write( "</td>" & VBCR )
Response.write( "</tr>" & VBCR )
End If
Call CloseAll()
Response.Write( "<tr class=status>" & VBCR )
Response.Write( "<th colspan=2><br>" & VBCR )
Response.Write( "<input type=submit name=AppFunction value='UPDATE PRESS RELEASE ATTACHMENT'>" & VBCR )
Response.Write( "<input type=submit name=AppFunction value='CANCEL'>" & VBCR )
Response.Write( "</th>" & VBCR )
Response.Write( "</tr>" & VBCR )
Response.Write( "</table>" & VBCR )
Response.Write( "</form>" & VBCR )
End Function
Public Function UpdatePressRelease()
Dim strDate, user
Set objConn = Server.CreateObject( "ADODB.Connection" )
Set objRS = Server.CreateObject( "ADODB.Recordset" )
objConn.Open = strDBConnection
If Err.Number <> 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB Failure Error Trap '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "DB Connection Error UpdatePressRelease" )
End If
strSQL = "UPDATE pressrelease " _
& "SET visible=" & Request.Form( "Visible" ) & ", " _
& "Headline='" & EscapeApostrophe( Request.Form( "Headline" ) ) & "', " _
& "SubHeadline='" & EscapeApostrophe( Request.Form( "SubHeadline" ) ) & "', " _
& "idDateline=" & Request.Form( "idDateline" ) & ", " _
& "DateStamp='" & FormatMySQLDate( Request.Form( "DateStamp" ) ) & "', " _
& "Body='" & EscapeApostrophe( Request.Form( "Body" ) ) & "', " _
& "idBoilerplate=" & Request.Form( "idBoilerplate" ) & " " _
& "WHERE idpressrelease = " & Request.Form( "idPressRelease" )
objConn.BeginTrans
Set objRS = objConn.Execute( strSQL )
objConn.CommitTrans
strDate = Now()
user = Session( "UserLogin" )
Response.Write("<script language='JavaScript'>alert('Updated by " & user & " on " & strDate & " ');</script>")
End Function
Public Function InsertForm()
Response.redirect("browse.asp")
End Function
Public Function ConfirmAttachment(filename)
%>
<form action=PRAttachAdmin.asp?AppFunction=CONFIRM method=post >
<table class=ts1>
<tr>
<th class=hdg1 colspan=2>ATTACHMENT MAINTENANCE</th>
</tr>
<tr>
<th><b>VISIBLE</b></th>
<th><b>PRESS RELEASE ID</b></th>
</tr>
<tr>
<th>
<input type=radio name="visible" value=1 checked>Visible<br>
<input type=radio name="visible" value=0 >Not Visible<br>
</th>
<th><input type=Text name="idPressRelease" readonly value='<%=Session("strIdPressRelease")%>'></th>
</tr>
<tr>
<th colspan=2><br><b>FILE NAME</b></th>
</tr>
<tr>
<th colspan=2><input type="text" readonly name=filename value="<%=filename%>" size=130></th>
</tr>
<tr>
<th colspan=2><br><b>FILE DESCRIPTION (LINK)</b></th>
</tr>
<tr>
<th colspan=2><input type="text" name="FileDescription" value="" size=130></th>
</tr>
<tr class=status>
<th colspan=2><input type="submit" value="CONFIRM" name=AppFunction size=85 id=confirm1 >
</th>
</tr>
</table>
</form>
<%
End Function
Public Function InsertAttachment()
Dim objStream
DIm objFSO, objFile, objFile2
dim strFDPathInfo, strPhysicalPath, strServerPath, strParentFolderPath
Dim strExtName
Dim BinaryStream, strAbsFile, strPath
Dim folder, strFileSize
Dim objChecker,grantAccess, itExistsServer, utilities, itExists
Dim objUpload
Dim strFileName
Const adTypeBinary = 1
Const adUseClient = 3
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adTypeText = 2
Const adSaveCreateOverWrite = 2
strFileName= request.form("FileName")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strServerPath=Request.ServerVariables("PATH_INFO")
strPhysicalPath=Server.MapPath("PRAttach")
strPhysicalPath=strPhysicalPath & "\" & strFileName
Set objFile = objFSO.GetFile(strPhysicalPath)
strFileSize=objFile.Size
if strFileSize > 1000000 then
''
Response.Write("<b>The size of this file exceeds the connection limits, please contact the web master.")
Response.End
End If
' Create Stream object
Set BinaryStream = CreateObject("ADODB.Stream")
'Specify stream type - binary
BinaryStream.Type = adTypeBinary
'Response.CharSet = "UTF-8"
'Open the stream And write binary data To the object
BinaryStream.Open
'Load the file data from disk To stream object
BinaryStream.LoadFromFile CStr(strPhysicalPath )
Set objFile = objFSO.getFile(strPhysicalPath)
Set objConn = Server.CreateObject( "ADODB.Connection" )
Set objRS = Server.CreateObject( "ADODB.Recordset" )
objConn.CursorLocation = adUseClient
objConn.Open = strDBConnection
If Err.Number <> 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB Failure Error Trap '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "DB Connection Error InsertAttachment" )
End If
'--------------------------------------------------------------------------
' Insert information in table File Descrption, File Name, File Path,
'server name, file type
' into Attachment table
'------------------------------------------------------------------------
objRS.Open "SELECT * FROM attachment WHERE 1 = 0", objConn, adOpenStatic, adLockOptimistic
objRS.AddNew
objRS( "FileName" ) = strFileName
objRS("FileContent")= BinaryStream.Read
'Set block size to 64kB
'Const BlockSize = &H10000
'Process source data using blocks
'' Dim BlockCounter, DataBlock
'' For BlockCounter = 0 To BinaryStream.Length Step BlockSize
'Get a part of source data
'' DataBlock = BinaryStream.ByteArray(BlockCounter, BlockSize)
'Add a part of source data to the field
'objRS("FileContent").AppendChunk DataBlock
'Next 'BlockCounter
objRS( "FileDescription") = request.form("FileDescription")
objRS("FilePath")="PRATTACH"
objRS( "FileSize" ) = objFile.Size
objRS( "FileServer" ) = Request.ServerVariables( "SERVER_NAME" )
strExtName = Right(trim(strFileName),3)
strExtName=LCase(strExtName)
'strExtName="doc"
if strExtName= "pdf" then
objRS( "idIcon" ) = 1
elseif strExtName = "doc" then
objRS( "idIcon" ) = 2
else
objRS( "idIcon" ) = 3
end if
objRS.Update
If Err.Number <> 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB Failure Error Trap '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "DB Connection Error from update attachment" )
End If
DIm strVisible, idAttachment
' objRS.Open "SELECT Max(idAttachment) AS ID FROM Attachment", objConn, adOpenStatic, adLockOptimistic
idAttachment=objRS("idAttachment")
objRS.Close
'Now Select the new idAttachment and update the pr_attach_xref
objRS.Open "SELECT * FROM pr_attach_xref WHERE 1 = 0", objConn, adOpenStatic, adLockOptimistic
objRS.AddNew
objRS( "Visible" ) = Request.Form("Visible")
objRS("idPressRelease") = Session("strIdPressRelease")
objRS( "idAttachment") = idAttachment
objRS.Update
If Err.Number <> 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB Failure Error Trap '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "DB Connection Error from update pr_attach_Xref attachment" )
End If
BinaryStream.Close
Set BinaryStream = Nothing
objConn.Close
Set objConn = Nothing
'objFile.Delete(true)
Set objFSO = Nothing
End Function
Public Function DeleteRecord()
Dim objConn2, objRS2, strSQL2
Dim objFSO,strServerPath, strPhysicalPath, strFileName
Set objConn2 = Server.CreateObject( "ADODB.Connection" )
Set objRS2 = Server.CreateObject( "ADODB.Recordset" )
objConn2.Open = strDBConnection
If Err.Number <> 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB Failure Error Trap '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "DB Connection Error DeleteRecord" )
End If
Set objRS2 = Nothing
strSQL2 = "DELETE FROM attachment " _
& "WHERE idAttachment = " & Request.QueryString( "idAttachment" )
Set objRS2 = objConn2.Execute( strSQL2 )
Set objRS2 = Nothing
strSQL2 = "DELETE FROM pr_attach_xref " _
& "WHERE idAttachment = " & Request.QueryString( "idAttachment" )
Set objRS2 = objConn2.Execute( strSQL2 )
Set objRS2 = Nothing
objConn2.Close
Set objConn2 = Nothing
Session( strScriptName & "_TotalRows" ) = GetTotalRows( "attachment" )
End Function
Public Function DebugScript( boolDebug )
Dim inputfield, inputvalue
If boolDebug Then
Response.Write( "<center><br>" & VBCR )
Response.Write( "<div style=background-color:#FFFFFF;width:770px;>" & VBCR )
Response.Write( "<p class=heading2>Debug Info</p>" & VBCR )
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' SQL Statement '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "<p class=maintext1 style=text-align:left>strSQL = " & strSQL & "</p>" & VBCR )
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Form Post Data '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "<table class=ts1>" & VBCR )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th class=hdg1 colspan=2>FORM INPUT VALUES</th>" & VBCR )
Response.Write( "</tr>" & VBCR )
For Each inputField in Request.Form
For Each inputValue in Request.Form( inputField )
Response.Write( "<tr>" & VBCR )
Response.Write( "<th>" & inputField & "</th>" & VBCR )
Response.Write( "<td>" & inputValue & "</td>" & VBCR )
Response.Write( "</tr>" & VBCR )
Next
Next
Response.Write( "</table>" & VBCR )
End If
Response.Write( "</div>" & VBCR )
Response.Write( "<br>" & VBCR )
End Function
Public Function ListDatelines( idDateline )
Dim objConn2, objRS2, strSQL2
Set objConn2 = Server.CreateObject( "ADODB.Connection" )
Set objRS2 = Server.CreateObject( "ADODB.Recordset" )
objConn2.Open = strDBConnection
If Err.Number <> 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB Failure Error Trap '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "DB Connection Error from ListDatelines " )
End If
strSQL2 = "SELECT DL.iddateline, DL.city, DL.state " _
& "FROM dateline AS DL " _
& "ORDER BY DL.city"
Set objRS2 = objConn2.Execute( strSQL2 )
If Not IsNull( idDateline ) Then
While Not objRS2.EOF
If CInt( idDateline ) = CInt( objRS2( "idDateline" ) ) Then
Response.Write( "<option value=" & objRS2( "idDateline" ) & " selected>" & UCase( objRS2( "City") ) & ", " & UCase( objRS2( "State" ) ) & VBCR )
Else
Response.Write( "<option value=" & objRS2( "idDateline" ) & ">" & UCase( objRS2( "City") ) & ", " & UCase( objRS2( "State" ) ) & VBCR )
End If
objRS2.MoveNext
WEnd
Else
While Not objRS2.EOF
Response.Write( "<option value=" & objRS2( "idDateline" ) & ">" & UCase( objRS2( "City") ) & ", " & UCase( objRS2( "State" ) ) & VBCR )
objRS2.MoveNext
WEnd
End If
objRS2.Close
Set objRS2 = Nothing
objConn2.Close
Set objConn2 = Nothing
End Function
Public Function ListBoilerplates( idBoilerplate )
Dim objConn2, objRS2, strSQL2
Set objConn2 = Server.CreateObject( "ADODB.Connection" )
Set objRS2 = Server.CreateObject( "ADODB.Recordset" )
objConn2.Open = strDBConnection
If Err.Number <> 0 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' DB Failure Error Trap '
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Response.Write( "DB Connection Error ListBoilerplates" )
End If
strSQL2 = "SELECT BP.idBoilerplate, BP.Boilerplate, C.LongName, C.Display " _
& "FROM boilerplate AS BP " _
& "INNER JOIN company AS C " _
& "ON BP.idCompany = C.idCompany " _
& "WHERE C.Display = 'Y' " _
& "ORDER BY C.LongName"
Set objRS2 = objConn2.Execute( strSQL2 )
If Not IsNull( idBoilerplate ) Then
Response.Write( "<input type=radio name=idBoilerplate value=NULL>No Boilerplate" & "<br>" & VBCR )
While Not objRS2.EOF
If idBoilerplate = objRS2( "idBoilerplate" ) Then
Response.Write( "<input type=radio name=idBoilerplate value=" & objRS2( "idBoilerplate" ) & " title='" & objRS2( "boilerplate" ) & "' checked>" & objRS2( "LongName" ) & "<br>" & VBCR )
Else
Response.Write( "<input type=radio name=idBoilerplate value=" & objRS2( "idBoilerplate" ) & " title='" & objRS2( "boilerplate" ) & "'>" & objRS2( "LongName" ) & "<br>" & VBCR )
End If
objRS2.MoveNext
WEnd
Else
Response.Write( "<input type=radio name=idBoilerplate value=NULL checked>No Boilerplate" & "<br>" & VBCR )
While Not objRS2.EOF
Response.Write( "<input type=radio name=idBoilerplate value=" & objRS2( "idBoilerplate" ) & " title='" & objRS2( "boilerplate" ) & "'>" & objRS2( "LongName" ) & "<br>" & VBCR )
objRS2.MoveNext
WEnd
End If
objRS2.Close
Set objRS2 = Nothing
objConn2.Close
Set objConn2 = Nothing
End Function
Public Function StatusBar()
Response.Write( "<tr class=status>" & VBCR )
Response.Write( "<td colspan=3>" & VBCR )
If CInt( intOffsetRow ) <= 0 Then
Response.Write( "<input type=submit name=AppFunction value='FIRST' disabled style=margin-right:15px>" )
Else
Response.Write( "<input type=submit name=AppFunction value='FIRST' style=margin-right:15px>" )
End If
If CInt( intOffsetRow ) > 0 Then
Response.Write( "<input type=submit name=AppFunction value='PREV'>" )
Else
Response.Write( "<input type=submit name=AppFunction value='PREV' disabled>" )
End If
If ( intOffsetRow + MAX_ROWS ) < Session( strScriptName & "_TotalRows" ) Then
Response.Write( "<input type=submit name=AppFunction value='NEXT'>" )
Else
Response.Write( "<input type=submit name=AppFunction value='NEXT' disabled>" )
End If
If CurrentPageCount( intOffsetRow ) = GetLastPageCount( Session( strScriptName & "_TotalRows" ) ) Then
Response.Write( "<input type=submit name=AppFunction value='LAST' disabled style=margin-left:15px>" )
Else
Response.Write( "<input type=submit name=AppFunction value='LAST' style=margin-left:15px>" )
End If
Response.Write( "</td>" & VBCR )
Response.Write( "<td align=right>Page <input type=text name=JUMP size=1 value=" & CurrentPageCount( intOffsetRow ) & "> of " & GetLastPageCount( Session( strScriptName & "_TotalRows" ) ) & "</td>" & VBCR )
Response.Write( "</tr>" & VBCR )
End Function
%>
<message edited by TNO on Monday, November 12, 2007 2:48 PM>