473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ASP - unexpected error

Hi im having a proble with this code, please can someone help it says unexpected error on line 5, event = Replace(Server.HTMLEncode(Request.Form("event"))," '","''")

thanks in advance

here is my code can anyone see anything wrong with this?
Expand|Select|Wrap|Line Numbers
  1.  <% 
  2. response.buffer = true
  3.  
  4. date = Replace(Server.HTMLEncode(Request.Form("date")),"'","''")
  5. event = Replace(Server.HTMLEncode(Request.Form("event")),"'","''")
  6. venue = Replace(Server.HTMLEncode(Request.Form("venue")),"'","''")
  7. details = Request.Form("details")
  8. details = Replace(details , "'", "''")
  9. details = Replace(details, vbcrlf, "<br>")
  10.  
  11. if date = "" OR event = "" OR venue = "" OR details = "" then
  12. Response.Redirect("post.asp?error=1")
  13. end if
  14. if instr(LCase(details), "<script") <> 0 then 
  15. Response.Redirect("post.asp?error=2")
  16. end if
  17.  
  18. set conn = Server.CreateObject("ADODB.connection")
  19. sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ 
  20. "Data Source=" & Server.MapPath("\upcoming Events\db\upcoming.mdb") & ";" & _ 
  21. "Persist Security Info=False" 
  22. conn.Open(sConnection) 
  23.  
  24. sqlstring = "INSERT INTO board ( date, event, venue, details ) " &_ 
  25. "values ('" & date & "','" & event & "','" & venue & "','" & details & "')" 
  26. conn.Execute(sqlstring)
  27. conn.Close 
  28. set conn = Nothing
  29. Response.redirect "\upcoming events\defualt.asp"
  30. %>
  31.  
Apr 19 '08 #1
2 2652
deric
92
Request.Form("") might have returned a Null or nothing value. Replace function will return an error if the string in the first argument is a null/nothing.
If it is possible that Request to a form will return nothing (eg, "event" doesn't exists in your form), it is good that you check the returned value first.
You may use "Is Nothing" or "IsNullOrEmpty" for that...
Apr 21 '08 #2
Request.Form("") might have returned a Null or nothing value. Replace function will return an error if the string in the first argument is a null/nothing.
If it is possible that Request to a form will return nothing (eg, "event" doesn't exists in your form), it is good that you check the returned value first.
You may use "Is Nothing" or "IsNullOrEmpty" for that...
Thanks for the help is working now silly mistake take care
Apr 21 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: | last post by:
Some time ago I installed VC# 2003, made a small generic project, compile with the allow unsafe flag and I get the error below: "error CS1577: Assembly generation failed -- Unexpected exception...
3
by: Eric Anderson Vianet SAO | last post by:
hello all When i tried ´pg_dump -v -f dump.dmp dtbtransporte´ I got the error: pg_dump: restoring data for table tbdmovimento pg_dump: dumping out the contents of table tbdmovimento ...
5
by: Vijayakrishna Pondala | last post by:
Hi, We are using the following error randomly, when accessing a webservice method/servlet hosted on JBoss application server: The underlying connection was closed: An unexpected error occurred...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
8
by: Jim Michaels | last post by:
C:\prj\quiz\withusers>php tareports.php PHP Parse error: syntax error, unexpected T_ELSE in C:\prj\quiz\withusers\tareports.php on line 205 this is the section of code. if (isset($row4)) {...
11
by: MLH | last post by:
Private Sub ButtonP_Click() On Error GoTo Err_ButtonP_Click Dim ThisForm As String ThisForm = Me.Name Exit_ButtonP_Click: Exit Sub Err_ButtonP_Click: Dim r As String, k As String, Message3...
8
by: Wescotte | last post by:
The error message Parse error: syntax error, unexpected $end in FILE on line X is one I run into frequently and I know the cause is I missed an ending quote. Is there an easy way to determine...
1
by: soidariti | last post by:
database error - parse error, unexpected $, expecting kEND AddUserAuthorisationToUsers.rb migration file 1. class AddUserAuthorisationToUsers < ActiveRecord::Migration 2. def self.up ...
1
by: Mrozik | last post by:
Hi! I have a problem - after deploying application in client environment, on some client machines occured error. Environment: App server: ASP.NET WebService/Win 2003/ secured SSL (.NET 2.0)...
20
by: Jim Michaels | last post by:
I have a 638 line glob of PHP code & HTML that won't run. I get "PHP Parse error: syntax error, unexpected '}' in quiz\\quiz.php on line 594". I wrote a brace checker that checks perens, square...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.