Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: easy one:)

  1. #1
    New to the CF scene
    Join Date
    May 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question easy one:)

    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

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    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&"'"
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •