473,287 Members | 1,419 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,287 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 2650
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.