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 3 of 3
  1. #1
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Data Type Mismatch

    hey guys im getting this error.

    Error Type:
    Microsoft JET Database Engine (0x80040E07)
    Data type mismatch in criteria expression.
    /SamDave/Pages/ShowNews.asp, line 55

    this is my line 55 now.

    <% cnnLogin.execute("UPDATE _news SET news_views = news_views + 1 WHERE ID = '" & request.QueryString("show") & "'") %>

    Table Name = _News
    Updating Into = news_VIEWS = Text



    i googled the error and found nothing that would help
    please help.
    -baleric

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Is the ID field numeric or text? If it's numeric then you should remove the single quotes.

    Code:
    <% cnnLogin.execute("UPDATE _news SET news_views = news_views + 1 WHERE ID = " & request.QueryString("show")) %>
    But make sure the input id is numeric.

    Code:
    <%
    dim id
    id = request.QueryString("show")
    if not isnumeric(id) then
      response.write "Invalid id."
      response.end
    end if
    '...
    cnnLogin.execute("UPDATE _news SET news_views = news_views + 1 WHERE ID = " & id) 
    %>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank u very much works like a charm
    woot woot


  •  

    Posting Permissions

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