473,382 Members | 1,147 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,382 software developers and data experts.

Expected end of statement error

Can anyone tell me where the problem is here ? - Thanks


Error:

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/test/ADO/demo_add.asp, line 15

sql=sql & "'" & Request.Form("country") & "')"on error resume next
----------------------------------------------^


Form code:

[HTML]<html>
<body><form method="post" action="demo_add.asp">
<table>
<tr>
<td>CustomerID:</td>
<td><input name="custid"></td>
</tr><tr>
<td>Company Name:</td>
<td><input name="compname"></td>
</tr><tr>
<td>Contact Name:</td>
<td><input name="contname"></td>
</tr><tr>
<td>Address:</td>
<td><input name="address"></td>
</tr><tr>
<td>City:</td>
<td><input name="city"></td>
</tr><tr>
<td>Postal Code:</td>
<td><input name="postcode"></td>
</tr><tr>
<td>Country:</td>
<td><input name="country"></td>
</tr>
</table>
<br /><br />
<input type="submit" value="Add New">
<input type="reset" value="Cancel">
</form></body>
</html>
[/HTML]

Submit code:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body><%
  3. set conn=Server.CreateObject("ADODB.Connection")
  4. conn.Provider="Microsoft.Jet.OLEDB.4.0"
  5. conn.Open "/test/fpdb/northwind.mdb"
  6. sql="INSERT INTO customers (customerID,companyname,"
  7. sql=sql & "contactname,address,city,postalcode,country)"
  8. sql=sql & " VALUES "
  9. sql=sql & "('" & Request.Form("custid") & "',"
  10. sql=sql & "'" & Request.Form("compname") & "',"
  11. sql=sql & "'" & Request.Form("contname") & "',"
  12. sql=sql & "'" & Request.Form("address") & "',"
  13. sql=sql & "'" & Request.Form("city") & "',"
  14. sql=sql & "'" & Request.Form("postcode") & "',"
  15. sql=sql & "'" & Request.Form("country") & "')"on error resume next
  16. conn.Execute sql,recaffected
  17. if err<>0 then
  18.   Response.Write("No update permissions!")
  19. else 
  20.   Response.Write("<h3>" & recaffected & " record added</h3>")
  21. end if
  22. conn.close
  23. %>
  24.  
  25. </body>
  26. </html>
May 17 '07 #1
3 2832
acoder
16,027 Expert Mod 8TB
This seems to be an ASP problem, but I would assume that the "on error.." part of your code is too close for comfort (add a space).
May 17 '07 #2
After much fiddling and reducing the code to the essentials, I no longer get any errors and get confirmation "1 record added" however the data I am submitting isnt reflecting in the database only a new empty row is added to the database everytime:

submit page:

<html>
<body><form method="POST" action="demo_add.asp">
<table>
<tr>
<td>CustomerID:</td>
<td><input name="cname" size="20"></td>
</tr>
</table>
<br /><br />
<input type="submit" value="Add New">
<input type="reset" value="Cancel">
</form></body>
</html>

Add record:

<html>


<body>

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("/test/fpdb/tiny.mdb"))
SQL = "INSERT INTO Tiny (cname) Values('" & cname & "')"
//on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write("No update permissions!")
else
Response.Write("<h3>" & recaffected & " record added</h3>")
end if
conn.close
%>

</body>

</html>
May 17 '07 #3
acoder
16,027 Expert Mod 8TB
I'll move this to the ASP forum where you're more likely to get help with your problem.
May 17 '07 #4

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

Similar topics

1
by: Phil Powell | last post by:
Here is the function ArraySearch: '-------------------------------------------------------------------------------------- 'ArraySearch will return an integer value indicating the first...
7
by: Graham James Campbell CS2000 | last post by:
Having a nightmare problem with this and would appreciate any and all help. The situation is I want to move from a webform and format the user inputted text into some html I am storing in a...
6
by: Miranda | last post by:
Hello, could somebody please help me figure this error out. I'm at my wits end here. This is my connection & SQL statement: <%@Language="Javascript" %> <!--#include...
3
by: Matt | last post by:
When the ASP statement end with a _ character, then the next line cannot have comment ' character. Is that correct? Since I encountered the following error: Microsoft VBScript compilation...
5
by: andy.herrera | last post by:
I'm getting this Error Message. Expected ';' Please Select One: <form name="form1"> <<------------ Error is here. <select name="selectTrans" onChange="If (this.value == 'checkout')...
2
by: Edward S | last post by:
I would appreciate if someone could correct my SQL statement which is displaying a message Expected : End of Statement this statment is attached to a button on the form StrSQL = "PARAMETERS !!...
3
by: NeilH | last post by:
Hello All I was wondering if someone could offer a rather inexperienced person some advice. Im trying to get my asp page to look at an access data I created the following query in access...
39
by: eruanion | last post by:
Hi, I've been working on this for a while now and I can't seem to find out what is wrong with my code. I have 2 files one c3common.js which only contains javascript functions for my main html page...
1
by: nosaj070 | last post by:
Hi, I'm working on a project and it is my first time implementing VBA with Access. I know my SQL Statement is close, but it obviously isn't perfect, if any of you can see what the error is I'd really...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.