Kan ikke henter det ID indlægs nummer som bliver medtaget i databasen.
linket som jeg modtager pr. mail bliver ved med at værer det samme.
<% Response.Buffer = True %>
<HTML>
<BODY BGCOLOR="white">
<H1>aspSmartUpload : Sample 4</H1>
<HR>
<%
' Variables
' *********
Dim mySmartUpload
Dim file
Dim oConn
Dim oRs
Dim intCount
intCount=0
Session.LCID = 1030
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload
' ******
mySmartUpload.Upload
' ******
intCount = mySmartUpload.Save("./upload")
' Connect to the DB
' *****************
Set oConn = Server.CreateObject("ADODB.Connection")
curDir = Server.MapPath("database.mdb")
oConn.Open "DBQ="& curDir &";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;"
' Open a recordset
' ****************
strSQL = "SELECT * FROM Images"
Set oRs = Server.CreateObject("ADODB.recordset")
Set oRs.ActiveConnection = oConn
oRs.Source = strSQL
oRs.LockType = 3
oRs.Open
' Select each file
' ****************
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
If not file.IsMissing Then
' Add the current file in a DB field
' **********************************
oRs.AddNew
oRs("Images") = file.FileName
oRs("link") = mySmartUpload.form("link")
oRs("indhold") = mySmartUpload.form("indhold")
oRs("overskrift") = mySmartUpload.form("overskrift")
oRs("indledning") = mySmartUpload.form("indledning")
oRs("navn") = mySmartUpload.form("navn")
oRs("email") = mySmartUpload.form("email")
oRs("IP") = request.servervariables("REMOTE_ADDR")
oRs("dato") = now()
oRs.Update
intCount = intCount + 1
else
oRs.AddNew
oRs("Images") = "findesikke.jpg"
oRs("link") = mySmartUpload.form("link")
oRs("indhold") = mySmartUpload.form("indhold")
oRs("overskrift") = mySmartUpload.form("overskrift")
oRs("indledning") = mySmartUpload.form("indledning")
oRs("navn") = mySmartUpload.form("navn")
oRs("email") = mySmartUpload.form("email")
oRs("IP") = request.servervariables("REMOTE_ADDR")
oRs("dato") = now()
oRs.Update
idOfAddedRecord = oRs("ID")
End If
Next
' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.<BR>")
' Destruction
' ***********
oRs.Close
oConn.Close
Set oRs = Nothing
Set oConn = Nothing
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("database.mdb")
Conn.Open DSN
strSQL = "UPDATE Images SET dato = '" & dato & "', navn = '" & navn &"', email = '" & email &"', overskrift = '" & overskrift &"', indledning = '" & indledning &"', indhold = '" & indhold &"', Images = '" & Images &"', link = '" & link &"', IP = '" & IP &"', Hits = '" & Hits & "'"
strSQL = strSQL & "WHERE ID = 5 "
Conn.Execute(strSQL)
Conn.Close
Set Conn = Nothing
Set rs = Nothing
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("Driver={MicroSoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database.mdb"))
SQL = "SELECT TOP 1 * FROM Images WHERE id " & Request.QueryString("id")
Set rs = Conn.Execute(SQL)
Response.Write "<a href=""
http://www.floorballlife.com/trgallery/troningsovelser/read1.asp?id=" & RS("Id") & """>Click Here!</a>"
strBody = "Hej Søren Borck Larsen" & vbCrLf & "<br>"
strBody = strBody & "Der er blevet oprettet en ny nyhed af " & mySmartUpload.Form("dato") = now() & vbCrLf & "<br>"
strBody = strBody & "Der er blevet oprettet en ny nyhed af " & mySmartUpload.Form("navn") & vbCrLf & "<br>"
strBody = strBody & "Der er blevet oprettet en ny nyhed af <a href=""
http://www.floorballlife.com/trgallery/troningsovelser/read1.asp?id=" & ("Id") & """>Der er kommet nyt indlæg</a>" & vbCrLf & "<br>"
strBody = strBody & "FloorBallLife.com / Robot" & vbCrLf & "<br>"
strBody = strBody & "web-site: <a href=""
http://www.floorballlife.com"">http://www.floorballlife.com</a>" & vbCrLf & "<br>"
strBody = strBody & "e-mail: <a href=""mailto:postmaster@floorballife.com"">postmaster@floorballife.com</a>" & vbCrLf & "<br>"
Set JMail = Server.CreateObject("JMail.Message")
JMail.AddRecipient "webmaster@floorballlife.com", "Søren Borck Larsen"
JMail.ContentType = "text/html"
JMail.From = "postmaster@floorballlife.com"
JMail.FromName = "News system Robot"
JMail.Subject = "En nyhed er blevet oprettet"
JMail.Body = strBody
JMail.Priority = 3
JMail.Send("mail3.cliche.dk")
Set JMail = Nothing
rs.Close
Conn.Close
Set Conn = Nothing
Set rs = Nothing
%>
<p> </p>
</BODY>
</HTML>