Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

80040e14 Error - Syntax error (missing operator)

Posted on 2004-09-30
7
Medium Priority
?
230 Views
Last Modified: 2008-02-26
I keep getting an error (80040e14) when I try to delete a record in the table. I am passing the id of the record from a link created dynamicly from that table.

Here is the code for the page to delete the record:

<%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="../DB/connection.asp" -->
<%
microlab_id = Request.QueryString("id")
%>
<%
Response.Write("Id = " & microlab_id)
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="javascript" type="text/javascript">
function cfm(msg) {
if (confirm(msg)) {
return true
} else {
return false
}}
</script>
<title>List of Microlabs</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table border="1">
<tr><td>Title</td><td>Discription</td><td>Edit</td><td>Delete</td></tr>
<%
objSql = "microlabs"
Dim objConn
Set objConn = Server.CreateObject("ADODB.Recordset")
objConn.Source = objSql
objConn.ActiveConnection = conn.ConnectionString
objConn.CursorType = adOpenStatic
objConn.Open
Do While Not objConn.EOF
Response.Write("<tr>")
Response.Write("<td>" & objConn("micro_title") & "</td>")
Response.Write("<td>" & objConn("micro_discription") & "</td>")
Response.Write("<td><a href=edit.asp?id=" & objConn("micro_id") & ">Edit</td>")
Response.Write("<td><a href=delete.asp?id=" & objConn("micro_id") & " onClick=""" & "cfm('" & objConn("micro_discription") & "')"" " & ">Delete</td>")
Response.Write("</tr>")
objConn.MoveNext
Loop
objConn.Close
Set objConn = Nothing
conn.Close
Set conn = Nothing
%>
</table>
</body>
</html>

Here is the page to delete the record:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="../DB/connection.asp" -->
<%
microlab_id = Request.QueryString("id")
%>
<%=Response.Write("Id = " & microlab_id)%>
<%
idFound = False
'Gets a list of all Microlabs listed in the DB
objSelSQL = "microlabs"
Dim objSel
Set objSel = Server.CreateObject("ADODB.Recordset")
objSel.Source = objSelSQL
objSel.ActiveConnection = conn.ConnectionString
objSel.CursorType = adLockOptimistic
objSel.Open

Dim objDel
Set objDel = Server.CreateObject("ADODB.Recordset")
objDel.ActiveConnection = conn.ConnectionString
objDel.CursorType = adLockOptimistic
objDel.SQL = "Delete from microlabs Where micro_id = " & microlab_id & ""
objDel.Open SQL

Do While Not (objSel.EOF OR idFound)
If (StrComp(objSel("micro_id"), id, 1) = 0) Then
idFound = True
Else
objSel.MoveNext
End If
Loop

If (StrComp(idFound, "True", 1) = 0) Then
Response.Redirect("error.asp?errorID=1001")
End If
objSel.Close
objSel = Nothing
objDel.Close
objDel = Nothing
conn.Close
conn = Nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Deleted (<%=id%>)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="1;URL=show_micro.asp">
</head>
<body>
Microlab #<%=id%>, has now been deleted. You are being redirected back.
</body>
</html>

What am I doing wrong?
0
Comment
Question by:chadreeves1
  • 3
  • 2
  • 2
7 Comments
 
LVL 10

Accepted Solution

by:
m8rix earned 300 total points
ID: 12196659
Try and replace this line of code:

objDel.SQL = "Delete from microlabs Where micro_id = " & microlab_id & ""

With

objDel.SQL = "Delete from microlabs Where micro_id = " & microlab_id
0
 
LVL 15

Assisted Solution

by:joeposter649
joeposter649 earned 300 total points
ID: 12200059
I think you want more in this line...
objSelSQL = "microlabs"

Perhaps you're trying to do something like this...
objSelSQL  = "Select * from microlabs Where micro_id = " & microlab_id
Then check  objSel EOF before doing the delete.

Unrelated to your error but I think you want your onclick to look return cfm()...
Response.Write("<td><a href=delete.asp?id=" & objConn("micro_id") & " onClick=""" & "return cfm('" & objConn("micro_discription") & "')"" " & ">Delete</td>")

0
 
LVL 10

Expert Comment

by:m8rix
ID: 12213589
How did you go chadreeves1?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Author Comment

by:chadreeves1
ID: 12220741
Sorry Guys I have tried everything you were saying and nothing has worked I get a "Syntax error (missing operator) in query expression 'micro_id ='." With the code:<%
objSelSQL = "Select * from microlabs Where micro_id = " + microlab_id
Dim objSel
Set objSel = Server.CreateObject("ADODB.Recordset")
objSel.Source = objSelSQL
objSel.ActiveConnection = conn.ConnectionString
objSel.CursorType = adOpenDynamic
objSel.Open
'Acutally Deletes the givin record from the DB
objSel.Delete adAffectCurrent
objSel.Close
objSel = Nothing
conn.Close
conn = Nothing
%>

or the same error if I change it back.

Sorry it took me so long to respond I had a wedding to go to and I wasn't able to access the website to make any changes.
0
 
LVL 15

Expert Comment

by:joeposter649
ID: 12220870
What line is the error on?
Try this...
objSelSQL = "Select * from microlabs Where micro_id = '" & microlab_id & "'"

You might also want do this...
microlab_id = trim(Request.QueryString("id"))
0
 
LVL 1

Author Comment

by:chadreeves1
ID: 12221126
The error is on line 21
0
 
LVL 1

Author Comment

by:chadreeves1
ID: 12222038
I figuried out what was wrong. I recently changed the directory my page was in and forgot to update the links so all it was giving me was a cashed page from earlyer. when I go to the new page I get no problem that you all for your help I have split up the points evenly between you.

Thank you,
chadreeves1
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question