Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: easy one:)
08-13-2007, 02:35 PM #1
- Join Date
- May 2007
- Thanked 0 Times in 0 Posts
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:
DELETE = REQUEST.QUERYSTRING("DELETE")
IF DELETE<>"" THEN
SET rsDell = SERVER.CREATEOBJECT("ADODB.RECORDSET")
rsDell.open "DELETE * FROM main where Topic='"&DELETE&"'" , DBCONN, 3, 3
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.
08-13-2007, 03:33 PM #2
- Join Date
- Jun 2002
- London, UK
- Thanked 110 Times in 109 Posts
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&"'"
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.