Hi, I have a website that was developed a few years ago for me, site is proburn.com and has been happily running for a few years, however I have had to chnage hosts and I am now gwetting all sorts of errors. latest one is where a customer is trying to create a discs, yhis is also happening all over the site but if I can fix thsi I think the other errors will be the same.
here is the code and the full error is
Microsoft JET Database Engine error '80040e14
'Syntax error (missing operator) in query expression 'Description= "ss" AND visitorid= 2007271121302 AM0 AND IsInBasket=false'.
/proburn/createdisc.asp, line 50
<%
Option Explicit
Response.Buffer=true
'redirect code goes here
%>
<!--#include virtual="/inc_returntome.asp"-->
<!-- #include file="../tracker/tracker.asp"-->
<!-- #include file="inc_connections.asp"-->
<!-- #include file="../config.asp"-->
<%
Dim RST
Dim sqlStr
Dim redirectpage
Dim theStatus
Dim DiscName
Dim DiscDescription
if request("r")<>"" Then
redirectpage = request("r")
elseif request.form("r")<>"" Then
redirectpage = request.form("r")
else
redirectpage = "search.asp"
End If
if request.form("go")<>"" Then
MakeDisc()
if theStatus="" then
Response.Redirect redirectpage
End If
End IF
'==========================================================================================
function MakeDisc()
' Response.write sqlstr & "<br>"
If request.form("DiscName")<>"" Then DiscName = request.form("DiscName")
If request.form("DiscDescription")<>"" Then DiscDescription = request.form("DiscDescription")
Set RST = Server.CreateObject("ADODB.Recordset")
if session("UserID")>0 Then
sqlStr = "select * from proburndisc where Description='" & replace(DiscDescription,"'","''") & "' AND userid=" & session("userid") & " AND IsInBasket=false"
else
sqlStr = "select * from proburndisc where Description='" & replace(DiscDescription,"'","''") & "' AND visitorid=" & session("visitorid") & " AND IsInBasket=false"
End If
' response.write sqlstr
RST.Open sqlStr, strConnectProBurn, adOpenKeySet, adLockOptimistic
If RST.EOF Then
if session("UserID")>0 Then
RST.AddNew array("UserID","DiscName","Description","NoTracks","TotalValue","TotalDuration","DateCreated","LastActivity"), array(session("userid"),DiscName,DiscDescription,0,0,0,now(),now() )
else
RST.AddNew array("VisitorID","DiscName","Description","NoTracks","TotalValue","TotalDuration","DateCreated","LastActivity"), array(session("VisitorID"),DiscName,DiscDescription,0,0,0,now(),now() )
end if
if instr(redirectpage,"?") Then
redirectpage=redirectpage & "&id=" & RST("DiscID")
else
redirectpage=redirectpage & "?id=" & RST("DiscID")
End If
Session("ActiveDisc") = RST("DiscID")
Session("DiscName") = DiscName
Session("DiscDescription") = DiscDescription
else
theStatus = "Sorry, you already have a disc with this Description"
End If
RST.close
Set RST=Nothing
end function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><%=cPageTitle%>Create Pro-Burn Disc</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../style.css" rel="stylesheet" type="text/css">
<script>
function ValidateForm(thisForm)
{
var AlertString="Oops!\n\n";
var ErrorsFound = false;
if (thisForm.DiscName.value == 0){AlertString += "\n DISC NAME is required";ErrorsFound = true;}
if (thisForm.DiscDescription.value == 0){AlertString += "\n DESCRIPTION is required";ErrorsFound = true;}
if (ErrorsFound == true){alert (AlertString);return false;}else{return true;}
}
</script>
</head>
<body onload="document.createDisc.DiscName.focus()">
<!--#include file="../header.asp"-->
<table border="0" align="center" cellpadding="0" cellspacing="0" id="content">
<tr>
<td valign="top"><!--#include file="pb_header.asp" -->
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../pghd/create.gif" width="149" height="27"></td>
</tr>
</table>
<br>
<table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="section"><span class="sectionhdr"><b><img src="../pghd/sq.gif" hspace="5" align="absmiddle"></b>Create a Pro-Burn Disc</span><br>
<br>
Please enter a title for the Pro-Burn disc that you are about
to create. This will be printed on the CD.<br>
<br>
eg. Name: <b>Fiona's Favourites</b> Description: <b>Vol 5</b><br>
<br>
Would be printed on to your CD as: <b>Fiona's Favourites -
Vol 5</b><br>
<br>
You will have the opportunity to change the name later if you
like.<br>
<br>
<span class="theStatus"><b><%=theStatus%></b></span>
<div align="center">
<form name="createDisc" action="createdisc.asp" method="post" onSubmit="return ValidateForm(this);">
Name
<input name="DiscName" type="text" id="DiscName" value="<%=DiscName%>" size="10" maxlength="30" class="input">
Description
<input name="DiscDescription" type="text" id="DiscDescription" value="<%=DiscDescription%>" size="10" maxlength="30" class="input">
<input type="submit" value="create disc" class="btn">
<input name="r" type="hidden" value="<%=redirectpage%>">
<input name="go" type="hidden" value="y">
</form>
</div>
<br>
Click 'create disc' to continue.<br>
<br>
<a href="showdiscs.asp">If you have already created a disc that you would like to use please click here</a><br>
<div align="center"></div>
</td>
</tr>
</table></td>
</tr>
</table>
<!--#include file="../footer.asp"-->
</body>
</html>