...

View Full Version : easy one:)



sasha hantz
08-13-2007, 02:35 PM
response.write "<a href=admin.asp?DELETE=" & objRS.Fields("Topic") & ">delete</a>"



this wass the command for the delete that i use and sent to the page with those lines:



DIM DELETE
DELETE = REQUEST.QUERYSTRING("DELETE")

IF DELETE<>"" THEN
Dim rsDell
SET rsDell = SERVER.CREATEOBJECT("ADODB.RECORDSET")
rsDell.open "DELETE * FROM main where Topic='"&DELETE&"'" , DBCONN, 3, 3

Response.Redirect "admin.asp"
END IF





well...what i'm tring to do it to sign the records id and to point to delelete a record with the same id that was pointed.


i got to mention that when i'm doing the same action with other colmn on from the database i get fine results...but somehow that is niot working with the auto id numbers.

and that is the error i get

Microsoft JET Database Engine error '80040e07'

Data type mismatch in criteria expression.

SOS

Spudhead
08-13-2007, 03:33 PM
I wouldn't use a recordset for doing a delete. Just get the connection to execute the SQL directly:

strSQL = "DELETE * FROM main where Topic='"&DELETE&"'"
DBCONN.execute sSQL

If you're having problems with the SQL, just response.write(strSQL) instead of calling Execute. I'll bet you that the value you're getting in the DELETE variable isn't what your application is expecting. In fact, you say you're expecting an ID - an integer? - but your SQL uses the variable as a string.

Also - never, ever, ever drop unvalidated values straight into your SQL statements. It presents a remarkably easy way for nasty types to run whatever SQL code they like against your database.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum