 |
| ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 1st, 2003, 11:48 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Microsoft VBScript compilation error '800a03ee'
Hi there
This is a bit of a funny one because although I'm getting this error
Microsoft VBScript compilation error '800a03ee'
Expected ')'
the code should not have executed on the page yet until I submit the form. Here's my code:
<%
if request("added") <> Empty then
set con = server.createobject("ADODB.Connection")
con.open Application("my_ConnectionString")
SQLInsert = "INSERT INTO SubCategories(SubCatShort, SubCatLong, CategoryID) VALUES('"& (request("subcatShort"), "'", "''") &"', '"& (request("subCatLong"), "'", "''") &"', "& request("CategoryID") &")"
con.execute(SQLInsert)
response.redirect("categories.asp?cache="&server.U RLEncode(Now))
end if
%>
<table width="550" cellspacing="1" cellpadding="1" border="0" align="center">
<form name="add_category" action="add_categories.asp" method="POST">
<tr>
<td class="Table_Row_Heading">Name</td>
<td class="Table_Data">
<input name="SubCatShort" type="text" class="TextBox" size="35">
</td>
</tr>
<tr>
<td class="Table_Row_Heading">Description</td>
<td class="Table_Data">
<textarea name="SubCatLong" cols="35" rows="5"></textarea>
</td>
</tr>
<tr>
<td class="Table_Row_Heading">Belongs to Main Category</td>
<td class="Table_Data">
<select name="CategoryID">
<option value="1" selected>Books</option>
<option value="2">DVD's</option>
<option value="3">Music</option>
<option value="4">Accessories</option>
</select>
</td>
</tr>
<tr>
<td align="right" class="Table_Row_Heading" colspan="2">
<input type="hidden" name="added" value="1">
<input name="Submit" type="submit" class="Button" value=" Add Category ">
</td>
</tr>
</form>
I'm not sure why it's throwing this error up as soon as I access the page when it shouldn't be executing until I submit the form.
Any help would be greatly appreciated.
thanks
Adam
|
|

December 1st, 2003, 11:57 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Adam, you can't do this "if request("added") <> Empty then", you need to either use the IsEmpty() function, or change it to something like this:
if Len("" & request("added")) > 0 then
Also, I think you're missing some Replace function calls in your SQL string in places like this
..."& (request("subcatShort"), "'", "''") looks like it should be
..."& Replace(request("subcatShort"), "'", "''")
hth
Phil
|
|

December 1st, 2003, 12:15 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Adam,
Don't confusing compiling with running. The error you are seeing is a compilation error. All code is compiled even if it doesn't actually run.
Peter
------------------------------------------------------
Work smarter, not harder.
|
|

December 1st, 2003, 01:06 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Great, thanks guys - works a treat now.
However, I've also got an update page - to edit the category which plays up the same way as previously even though I've amended the code as you said. Do you know why this one is happening?
<%
if Len("" & request("added")) > 0 then
set con = server.createobject("ADODB.Connection")
con.open Application("my_ConnectionString")
SQLInsert = "UPDATE SubCategories SET SubCatShort = '"& replace(request("subcatShort"), "'", "''") &"', SubCatLong = '"& replace(request("subCatLong"), "'", "''") &"', CategoryID = "& replace(request("CategoryID") &" WHERE SubCategoryID = " & request("subcategoryID")
con.execute(SQLInsert)
response.redirect("categories.asp?cache="&server.U RLEncode(Now))
end if
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../Styles/Secure_Pages.css" type="text/css">
<style type="text/css">
<!--
.style1 {color: #000000}
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<%
SQLGetCategories = "SELECT * FROM SubCategories WHERE SubCategoryID = " & request("categoryID")
set rsCategories = con.execute(SQLGetCategories)
%>
<center>
<b><br>
<span class="style1">EDIT SUB CATEGORY</span></b>
</center>
<br>
<table width="550" cellspacing="1" cellpadding="1" border="0" align="center">
<form name="add_category" action="edit_categories.asp" method="POST">
<tr>
<td class="Table_Row_Heading">Name</td>
<td class="Table_Data">
<input name="SubCatShort" type="text" class="TextBox" value="<%=rsCategories("SubCatShort")%>" size="35">
</td>
</tr>
<tr>
<td class="Table_Row_Heading">Description</td>
<td class="Table_Data">
<textarea name="SubCatLong" cols="35" rows="5"><%=rsCategories("SubCatLong")%></textarea>
</td>
</tr>
<tr>
<td class="Table_Row_Heading">Belongs to Main Category</td>
<td class="Table_Data">
<select name="CategoryID">
<option <%if rsCategories("CategoryID") = 1 then%>selected <%end if%>value="1">Books</option>
<option <%if rsCategories("CategoryID") = 2 then%>selected <%end if%>value="2">DVD's</option>
<option <%if rsCategories("CategoryID") = 3 then%>selected <%end if%>value="3">Music</option>
<option <%if rsCategories("CategoryID") = 4 then%>selected <%end if%>value="4">Accessories</option>
</select>
</td>
</tr>
<tr>
<td align="right" class="Table_Row_Heading" colspan="2">
<input type="hidden" name="subcategoryID" value="<%=request("categoryID")%>">
<input type="hidden" name="added" value="1">
<input name="Submit" type="submit" class="Button" value=" Update Category ">
</td>
</tr>
</form>
</table>
</body>
</html>
The error is the same:
Microsoft VBScript compilation error '800a03ee'
Expected ')'
Many thanks
Adam
|
|

December 2nd, 2003, 04:28 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Adam, on this line
SQLInsert = "UPDATE SubCategories SET SubCatShort = '"& replace(request("subcatShort"), "'", "''") &"', SubCatLong = '"& replace(request("subCatLong"), "'", "''") &"', CategoryID = "& replace(request("CategoryID") &" WHERE SubCategoryID = " & request("subcategoryID")
drop the replace( from the CategoryID - that's why its expecting ), to close the replace call.
rgds
Phil
|
|

December 2nd, 2003, 06:06 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Once again, thanks Phil
|
|
 |