Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

80040e14 Error - Syntax error (missing operator)

Posted on 2004-09-30
7
Medium Priority
?
229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: 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!

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

670 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