#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Chicago, IL
    Posts
    85
    Rep Power
    13

    Unhappy new to asp... can't figure out update


    Wow. This has gotten extremely frustrating. I cannot for the life of me figure out how to use ASP. At least to update...

    here is the code I'm using (and I'm only trying to update one field!)

    <%

    dim connect
    dim output
    dim update_sql
    dim id

    id = Request.Form("id")

    'Start SQL
    update_sql = "UPDATE tblApartment SET"

    'Update status
    IF len(Request.Form("status")) THEN
    update_sql = update_sql & " Status = '" & _
    Request.Form("status") & "'"
    END IF

    'Update added_by

    'Set the where clause
    update_sql = update_sql & " WHERE ID = '" & _
    id & "'"


    Set connect = Server.CreateObject("ADODB.connection")
    connect.Open "DSN=mydsn"

    Set output = Server.CreateObject("ADODB.Recordset")

    output.Open update_sql, connect

    Response.Write "<hr noshade>The following insert string was executed "
    Response.Write update_sql

    connect.close
    set connect = Nothing
    %>

    And here is the error

    Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

    [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.


    If you can offer up any help... PLEASE DO!

    I'm pulling out hairs here
    Hope you are having a good day.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Chicago, IL
    Posts
    85
    Rep Power
    13

    ok


    It is indeed an autonumber field...

    so do you mind letting me know the proper syntax?

    Thanks!
    Hope you are having a good day.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    24
    Rep Power
    0
    where id=" & id get rid of the quotes
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Chicago, IL
    Posts
    85
    Rep Power
    13

    Thanks


    That's it. Starting to get the hang of the new code. Switching from CFMX to ASP wasn't as easy as I thought
    Hope you are having a good day.

IMN logo majestic logo threadwatch logo seochat tools logo