Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 error in script - pls help
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

scaramanga
Junior Member

United Kingdom
130 Posts

Posted - 24 July 2003 :  10:10:32  Show Profile  Visit scaramanga's Homepage  Send scaramanga an ICQ Message
I need help please and you may be able to help me!
I have added a postcard script to brightonized.net see below
SEND A POSTCARD
I was getting the error in the email part of the script CDONTS was not enabled my host uses JMail so I have changed that, see lines 88 to 100 on file attached. would the error I get now have anything to do with that?
this script worked properly when my other host had CDONTS enabled
please help
error is showing:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID='.

/post/send.asp, line 123

scaramanga
Junior Member

United Kingdom
130 Posts

Posted - 24 July 2003 :  10:12:08  Show Profile  Visit scaramanga's Homepage  Send scaramanga an ICQ Message
<!--#include file="common.asp"-->
<script>
function submitit(){
var name = document.theform.name.value
var email = document.theform.email.value
if (name==""){
alert("Fill your name")
document.theform.name.focus()
return false
}

if (email.indexOf('@', 0) == -1 || email.indexOf('.', 0) == -1){
alert("No valid e-mail address!");
document.theform.email.focus()
return false

}
}

</script>
<%
dim pic,action,rndNumber
pic = request.queryString("pic")

action = request("action")
select case action
case "send"
Const fsoForWriting = 2

Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

'Open the text file
Dim objTextStream
'*******************************************
'change the path to your path!!!!!!!!!!!!
'*******************************************
randomize
rndNumber = rnd*1000000000000
rndNumber = int(rndNumber)
dim path
path = server.MapPath("postcards/"&rndNumber&".htm")


Set objTextStream = objFSO.OpenTextFile(path, fsoForWriting, True)



'Display the contents of the text file
objTextStream.WriteLine "<html><head><title>POSTCARDS</title></head>"
objTextStream.WriteLine "<body bgcolor=white>"
objTextStream.WriteLine "<table border=0 align=center>"
objTextStream.WriteLine "<tr align=center><td><img src='../images/" & request.form("ImageId") & "' width='374' height='269' border='0'></tr></td>"
objTextStream.WriteLine "<tr align='center'><td>" & request.form("mes") & "</tr></td>"
objTextStream.WriteLine "<tr align='center'><td>regards :" & request.form("name") & "</td></tr>"
'**************change the url to your server!********************
objTextStream.WriteLine "<tr><td align=center><a href='http://www.brightonized.net/post'>Send a postcard</a></td></tr>"
objTextStream.WriteLine "</table></body>"

'Close the file and clean up
objTextStream.Close
Set objTextStream = Nothing
Set objFSO = Nothing


'Dim objCDO
'Set objCDO = Server.CreateObject("CDONTS.NewMail")
'objCDO.To = request.form("email")
'objCDO.From = "brightonized@brightonized.net"
'objCDO.Subject = "New postcard has Arrived from brightonized"
'objCDO.Body = request.form("name") & " sent you postcard! go to http://www.brightonized.net/post/postcards/"&rndNumber&".htm"
'objCDO.Send
'set objCDO = nothing

'Dim JMail
'Set JMail = Server.CreateObject("JMail.SMTPMail")
'Next line needs checking (needs server address, may work if you rem the line (put ' at the start))
'JMail.ServerAddress = "smtp.syphonhosting.com"
'JMail.ContentType = "text/html"
'JMail.Sender = "karl@bedingfield.org.uk"
'JMail.SenderName = "brightonized@brightonized.net"
'JMail.Subject = "New postcard has Arrived from brightonized"
'JMail.AddRecipient request.form("email")
'JMail.Body = request.form("name") & " sent you postcard! go to http://www.brightonized.net/post/postcards/"&rndNumber&".htm"
'this will need checking also (don't know JMAIl send command (99.9% probably send))
'JMail.execute
'set JMail = nothing
case "jmail"
Set objNewMail = Server.CreateObject("Jmail.smtpmail")
objNewMail.ServerAddress = SMTP.syphonhosting.com
objNewMail.AddRecipient strRecipients
objNewMail.Sender = brightonized
objNewMail.Subject = POSTCARD
objNewMail.body = request.form("name") & " sent you postcard! go to http://www.brightonized.net/post/postcards/"&rndNumber&".htm"
objNewMail.priority = 3
on error resume next '## Ignore Errors
objNewMail.execute
If Err <> 0 Then
Err_Msg = Err_Msg & "<li>Your request was not sent due to the following error: " & Err.Description & "</li>"
End if

response.write "<script>alert('Thankyou, your brightonized postcard has been sent!');location.href='index.asp'</script>"
response.end
end select
%>



<title>Untitled</title>
</head>

<body>
<form name="theform" action="send.asp?action=send" method="post" onsubmit="return submitit()">
<table border=0 align="center">
<td align="center"> <img src="images/main.jpg" border="0" alt="" width="300" height="88">
</td>
</tr>
<%
set conn=server.createobject("adodb.connection")
set rs=server.createobject("adodb.recordset")
conn.open dsn
sql = "select * from postcard where ID="&pic
<i>(line123)</i><b>rs.open sql,conn%></b>
<input type="hidden" name="ImageId" value="<%=rs("imageName")%>">
<tr align=center><td><img src="images/<%=rs("imageName")%>" border="0" alt=""><br></tr>
<tr align="center"><td>Write your name:<br><input type=text name=name size=25><br></td>
<tr align="center"><td>Write Reciever email:<br><input type=text name=email size=25><br></td>
<tr align="center"><td>Write your Message:<br><textarea cols=30 rows=7 name="mes"></textarea><br></td>
<tr align="center"><td><input type="submit" name="submit" value="Send"></tr>
</table>

<%call close()%>

</form></body></html>

Edited by - scaramanga on 24 July 2003 10:21:30
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 24 July 2003 :  11:56:54  Show Profile
Probably the picture ID value isn't getting to your asp page properly. A helpful debug is to insert a response.write whateverthesqlis just before you execute the sql so you can see the "built" sql string in your browser. Many errors become obvious once you inspect your sql.

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

scaramanga
Junior Member

United Kingdom
130 Posts

Posted - 25 July 2003 :  10:00:09  Show Profile  Visit scaramanga's Homepage  Send scaramanga an ICQ Message
thanks doug but I don't understand it?!
Go to Top of Page

Anacrusis
Junior Member

USA
219 Posts

Posted - 25 July 2003 :  10:34:09  Show Profile  Visit Anacrusis's Homepage  Send Anacrusis an AOL message
right after this line:
sql = "select * from postcard where ID="&pic

put this:
response.write sql

I'm guessing that your 'pic' variable is empty, writing out the sql to your browser will confirm this.

The Internet ClubHouse
www.internet-clubhouse.com
Go to Top of Page

scaramanga
Junior Member

United Kingdom
130 Posts

Posted - 28 July 2003 :  03:49:40  Show Profile  Visit scaramanga's Homepage  Send scaramanga an ICQ Message
thanks, I now get the following error:

select * from postcard where ID=
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'ID='.

/post/send.asp, line 124


Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 28 July 2003 :  07:53:36  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
Is your form POST or GET? This is the line failing pic = request.queryString("pic") There is no value for pic. Is that field in the form on the previous page and is the form a GET submission? You need both of those true for that line to work.

Dave Maxwell
Barbershop Harmony Freak
Go to Top of Page

scaramanga
Junior Member

United Kingdom
130 Posts

Posted - 30 July 2003 :  06:21:04  Show Profile  Visit scaramanga's Homepage  Send scaramanga an ICQ Message
my mate said it was this

sql = "select * from postcard where ID="&pic

had to be

sql = "select * from postcard where ID= "'"& pic &"'"


this still doesn't work!
Go to Top of Page

Shaggy
Support Moderator

Ireland
6780 Posts

Posted - 30 July 2003 :  06:42:49  Show Profile
Nope, your code is right. As dave suggested your form is using the post method so you need to change the line that reads pic = request.queryString("pic") to pic = request.Form("pic"). Wouldn't hurt to make sure it's an integer being passed as well: pic = cInt(request.Form("pic"))


Search is your friend
“I was having a mildly paranoid day, mostly due to the
fact that the mad priest lady from over the river had
taken to nailing weasels to my front door again.”
Go to Top of Page

scaramanga
Junior Member

United Kingdom
130 Posts

Posted - 30 July 2003 :  09:06:28  Show Profile  Visit scaramanga's Homepage  Send scaramanga an ICQ Message
I added the integer pic = cInt(request.Form("pic"))
and now I get this:

ADODB.Field error '80020009'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/post/send.asp, line 0

Edited by - scaramanga on 30 July 2003 09:07:22
Go to Top of Page

scaramanga
Junior Member

United Kingdom
130 Posts

Posted - 30 July 2003 :  09:07:52  Show Profile  Visit scaramanga's Homepage  Send scaramanga an ICQ Message
thanks for all your help so far!
Go to Top of Page

scaramanga
Junior Member

United Kingdom
130 Posts

Posted - 03 August 2003 :  11:29:16  Show Profile  Visit scaramanga's Homepage  Send scaramanga an ICQ Message
please help
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.41 seconds. Powered By: Snitz Forums 2000 Version 3.4.07