Solved

80040e14 Error - Syntax error (missing operator)

Posted on 2004-09-30
7
226 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 75 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 75 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
Industry Leaders: 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pass asp session variable to a js function in an asp script 6 36
Insert Button on a table 16 56
Set time on Session (ASP) 14 38
VB script help 23 51
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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/…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

752 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