Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error message in deleting recods from database using with checkboxes 1

Status
Not open for further replies.

Beng79

Technical User
Jan 5, 2006
48
0
0
HK
Hi All,

I am trying to run an ASP script in deleting recods from database using with checkboxes and the following error message is seen:

-----------------------------------------------------------
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'FeatID=<FONT face=Arial><IMG onmouseup="FP_swapImg(0'.
/project/DeleteFeatures_verify.asp, line 88

Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Page:
POST 1560 bytes to /project/DeleteFeatures_verify.asp

POST Data:
Delete=7&Delete=%3CFONT+face%3DArial%3E%3CIMG+onmouseup%3D%22FP_swapImg%280%2C0%2C%2F*id*%2F%27img1%27%2C%2F*url*%2F%27Delete_1A.jpg%27%29%22+onmousedown%3D%22FP_swapImg%281%2C0%2C%2F*id*%2F%27img1%27 . . .
-----------------------------------------------------------

The ASP script(DeleteFeatures_verify.asp) is as below:
<%
Dim connectDel, recstDel
Dim intSno, intDelSno, a, SQL

intSno=Request("Delete")

Set connectDel = Server.CreateObject("ADODB.Connection")
connectDel.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("Estimation.mdb"))

a=split(intSno,",")

Dim iLoop
for iLoop=LBound(a) to UBound(a)
intDelSno=Trim(a(iLoop))
SQL = "Delete from FuncFeat where FeatID=" & intDelSno & ""
Set recstDel = connectDel.Execute(SQL)
'connectDel.Execute "Delete from FuncFeat where FeatID=" & intDelSno & ""
next
Response.Redirect "DeleteFeatures.asp"
connectDel.Close
Set recstDel = Nothing
Set connectDel=nothing
%>
-----------------------------------------------------------

The above ASP script(DeleteFeatures_verify.asp) is called when the DeleteFeatures.asp is executed.

The DeleteFeatures.asp is as below:
<form method="POST" action="DeleteFeatures_verify.asp" onSubmit="">
<p><!--[if gte vml 1]><v:line
id="_x0000_s1035" alt="" style='position:absolute;left:0;text-align:left;
top:0;flip:y;z-index:1' from="23.25pt,142.5pt" to="714pt,142.5pt"
strokecolor="#09f"/><![endif]--><![if !vml]><span style='mso-ignore:vglayout;
position:absolute;z-index:1;left:30px;top:189px;width:923px;height:2px'><img
width=923 height=2 src="DeleteFeatures59_files/image003.gif" v:shapes="_x0000_s1035"></span><![endif]></p>

<%
Dim connnectDel
Dim recstDel
Dim SQL
'Dim intCounter,intMod,rcolor
%>

<%
Set connectDel = Server.CreateObject("ADODB.Connection")
connectDel.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("Estimation.mdb"))

Set recstDel = Server.CreateObject("ADODB.recordset")

recstDel.Open "SELECT FuncFeat.FeatID,FuncFeat.FeatName,FuncFeat.ProjID from FuncFeat order by FuncFeat.ProjID", connectDel

'SQL = "SELECT FuncFeat.FeatID, FuncFeat.FeatName, FuncFeat.ProjID from FuncFeat order by FuncFeat.ProjID"
'Set recstDel = connectDel.Execute(SQL)
%>

<p><!--[if gte vml 1]><v:line
id="_x0000_s1048" alt="" style='position:absolute;left:0;text-align:left;
top:0;flip:y;z-index:1' from="24pt,384.75pt" to="714.75pt,384.75pt"
strokecolor="#09f"/><![endif]--><![if !vml]><span style='mso-ignore:vglayout;
position:absolute;z-index:1;left:31px;top:512px;width:923px;height:2px'><img
width=923 height=2 src="DeleteFeatures59_files/image003.gif" v:shapes="_x0000_s1048"></span><![endif]></p>
<p><span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp; </font></b></span></p>
<p><span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp; </font></b></span></p>

<table width="674" border="1" cellpadding="0" cellspacing="0" height="43" style="border-collapse: collapse">
<tr>
<th align="left" bgcolor=#0099CC width="70" height="13" bordercolor="#000000" bordercolorlight="#006699" bordercolordark="#006699">
<b><font color="#000080" face="Arial">
<input type="checkbox" name="C1" value="ON" style="font-weight: 700"></font><font color="#000080" face="Arial">Check
</font> </b>
<th align="left" bgcolor=#0099CC width="290" height="13" bordercolor="#000000" bordercolorlight="#006699" bordercolordark="#006699">
<p align="center"><font face="Arial" size="2" color="#000080">
Functional </font><font color="#000080"><b>
<font SIZE="2" FACE="Arial">
Feature </font><font face="Arial">&nbsp;</font></b></font><th align="left" bgcolor=#0099CC width="296" height="13" bordercolor="#000000" bordercolorlight="#006699" bordercolordark="#006699">
<p align="center"><font face="Arial" size="2" color="#000080">Project
ID</font></th>
</tr>

<%do until recstDel.EOF%>

<tr>
<td align="left" width="70" height="20">
<font SIZE="2" FACE="arial" COLOR="BLACK">
<width=35%>


&nbsp;<Input Type=CheckBox Name=Delete Value=<%=recstDel("FeatID")%>><td align="left" width="290" height="20">
<font SIZE="2" FACE="arial" COLOR="BLACK">
<%Response.Write (recstDel("FeatName"))%>&nbsp;</font>
<td align="center" width="296" height="20">
<font SIZE="2" FACE="arial" COLOR="BLACK">
<%Response.Write(recstDel("ProjID"))%>&nbsp;</font>
<%recstDel.MoveNext%>

</tr>
<%loop
Set recstDel=nothing
Set connectDel=nothing
%>
</table>

<div style="position: absolute; width: 128px; height: 26px; z-index: 2; left: 767px; top: 380px" id="Cancel">
&nbsp;</div>
<p>
<button name="Delete" type="submit" class="UserBackground" style="border-style:solid; border-width:0px; width: 135px; height: 26px; padding: 0" tabindex="15" value="Delete">
<font face="Arial">
<img border="0" id="img1" src="Delete_1C.jpg" height="25" width="125" alt="DELETE" fp-style="fp-btn: Embossed Rectangle 1; fp-font: Arial; fp-font-size: 12; fp-font-color-normal: #333399; fp-font-color-hover: #0000FF; fp-font-color-press: #333399" fp-title="DELETE" align="left" onmouseover="FP_swapImg(1,0,/*id*/'img1',/*url*/'Delete_1A.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img1',/*url*/'Delete_1C.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img1',/*url*/'Delete_1B.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img1',/*url*/'Delete_1A.jpg')"></font>
</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<button name="Clear" style="border-style:solid; border-width:0px; width: 135px; height: 26px" class="UserBackground" type="reset" tabindex="16">
<img border="0" id="img12" src="Clear_1C.jpg" height="25" width="125" alt="CLEAR" onmouseover="FP_swapImg(1,0,/*id*/'img12',/*url*/'Clear_1A.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img12',/*url*/'Clear_1C.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img12',/*url*/'Clear_1B.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img12',/*url*/'Clear_1A.jpg')" fp-style="fp-btn: Embossed Rectangle 1; fp-font: Arial; fp-font-size: 12; fp-font-color-normal: #333399; fp-font-color-hover: #0000FF; fp-font-color-press: #333399; fp-orig: 0" fp-title="CLEAR">
</button>
<font face="Arial">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="Functional%20Features%20submenu.htm">
<img border="0" id="img4" src="Cancel_1C.jpg" height="25" width="125" alt="CANCEL" onmouseover="FP_swapImg(1,0,/*id*/'img4',/*url*/'Cancel_1A.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img4',/*url*/'Cancel_1C.jpg')" onmousedown="FP_swapImg(1,0,/*id*/'img4',/*url*/'Cancel_1B.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img4',/*url*/'Cancel_1A.jpg')" fp-style="fp-btn: Embossed Rectangle 1; fp-font: Arial; fp-font-size: 12; fp-font-color-normal: #333399; fp-font-color-hover: #0000FF; fp-font-color-press: #333399; fp-orig: 0" fp-title="CANCEL"></a></font></p>
<p>&nbsp;</p>
<div style="position: absolute; left: 426px; top: 565px; width: 157px; height: 247px; z-index: 13" id="Feat6_10">
<div style="position: absolute; width: 125px; height: 25px; z-index: 16; left: 24px; top: 195px" id="Feat10">
<span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Feature 10</font></b></span><b><font face="Arial" color="#333399">:</font></b></div>
<div style="position: absolute; width: 125px; height: 25px; z-index: 17; left: 23px; top: 150px" id="Feat9">
<span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Feature 9</font></b></span><b><font face="Arial" color="#333399">:</font></b></div>
<div style="position: absolute; width: 125px; height: 25px; z-index: 18; left: 23px; top: 107px" id="Feat8">
<span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Feature 8</font></b></span><b><font face="Arial" color="#333399">:</font></b></div>
<div style="position: absolute; width: 125px; height: 25px; z-index: 19; left: 23px; top: 66px" id="Feat7">
<span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Feature 7</font></b></span><b><font face="Arial" color="#333399">:</font></b></div>
<div style="position: absolute; width: 125px; height: 25px; z-index: 20; left: 23px; top: 21px" id="Feat6">
<span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Feature 6</font></b></span><b><font face="Arial" color="#333399">:</font></b></div>
<p>&nbsp;</div>
<div style="position: absolute; left: -37px; top: 539px; width: 166px; height: 273px; z-index: 11" id="Feat1_5">
<div style="position: absolute; width: 125px; height: 25px; z-index: 13; left: 40px; top: 222px" id="Feat5">
<span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Feature 5</font></b></span><b><font face="Arial" color="#333399">:</font></b></div>
<div style="position: absolute; width: 125px; height: 25px; z-index: 14; left: 41px; top: 176px" id="Feat4">
<span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Feature 4</font></b></span><b><font face="Arial" color="#333399">:</font></b></div>
<div style="position: absolute; width: 125px; height: 25px; z-index: 15; left: 41px; top: 133px" id="Feat3">
<span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Feature 3</font></b></span><b><font face="Arial" color="#333399">:</font></b></div>
<div style="position: absolute; width: 125px; height: 25px; z-index: 16; left: 41px; top: 91px" id="Feat2">
<span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Feature 2</font></b></span><b><font face="Arial" color="#333399">:</font></b></div>
<div style="position: absolute; width: 125px; height: 25px; z-index: 17; left: 41px; top: 46px" id="Feat1">
<span style="vertical-align: middle"><b>
<font face="Arial" color="#333399">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Feature 1</font></b></span><b><font face="Arial" color="#333399">:</font></b></div>
<p>&nbsp;</div>

</form>
-----------------------------------------------------------
Thank you

Sorry for this long script.
 
mmy script is customised to:

<%
Dim connectDel, recstDel
Dim FeatureID

Set connectDel = Server.CreateObject("ADODB.Connection")
connectDel.Open("DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=" & Server.MapPath("Estimation.mdb"))

FeatureID = Request.QueryString("FeatID")
recstDel.Open "DELETE from FuncFeat WHERE FeatID=" & FeatID, connectDel

Set recstDel = Nothing
Set connectDel = Nothing

Response.Redirect("DeleteFeatures.asp")
%>

The error is still seen
 
You need to create the Recordset object:

Set recstDel=Server.CreateObject("ADODB.RecordSet")
 
Ok, it works for me now.
Thank you

By the way, how can I add one more column(except FeatID) from the DB table other than the "FeatName" so it can also be listed as well?

Another thing is how can I properly align the list shown since now its all centre align and there is no spacing between the delete link and "FeatName"?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top