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!

Querystring error 1

Status
Not open for further replies.

Beng79

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

I am trying to run a delete script with a list shown and a delete link next to them.

The list is shown and the FeatID is to be passed over to another script for request.querystring

<%
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")
%>

When trying to run the page in request.querystring, error is seen:
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: "
 
I don't see recstDel instantiated anywhere.

barcode_1.gif
 
Two things:

1) What is recstDel supposed to be? Recordset object? If so then create the object first.
2) You are doing this:
Code:
FeatureID = Request.QueryString("FeatID")
So the delete should be
Code:
"DELETE from FuncFeat WHERE FeatID=" & FeatureID
not
Code:
"DELETE from FuncFeat WHERE FeatID=" & FeatID

Thanks and Regards
Satish Kumar
 
recstDel is a recordset object and I have declare it in the 1st line:

Dim connectDel, recstDel

By the way, my FeatID in the table in Access DB is of datatype "Auto Number
 
Oops, forget to mention its a primary key of the table too.

Does this contributes to why there is an error?
 
recstDel is just an empty variable until you do something like this:[tt]
Set recstDel = Server.CreateObject("ADODB.Recordset")[/tt]

or this:[tt]
Set recstDel = connectDel.Execute("SELECT * FROM FuncFeat WHERE 1=2")[/TT]
 
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"?
 
These followup questions should be in separate threads but generally speaking it sounds like the first question is about the syntax of an SQL statement and the second question is more of an HTML question.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top