moving from one table to another using asp [with errors]

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default moving from one table to another using asp [with errors]

    I am having trouble moving a record from one table to another. I keep
    getting the following error:

    Microsoft VBScript runtime error '800a01a8'
    Object required: '[string: "rs('Photo') & ', ' &"]'
    /photogallery/adminupdate.asp, line 27

    I've included my code. Anyone know what this error means & how to go
    about remedying it? I'd appreciate any response!

    Thanks in advance!

    Jeremy

    <% LANGUAGE="VBScript"
    const adOpenDynamic = 2
    const adLockOptimistic = 3

    dim sqt

    'capture form elements
    accept = Request.form("accept")
    feature = Request.form("feature")
    key = Request.form("key")

    'open database and get the record based upon the key
    set conn = server.createobject("ADODB.Connection")
    conn.Open("DSN=photo")
    sqlText = "SELECT * FROM Table1 WHERE Photo = '" & key & "'"
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sqlText, conn, adLockOptimistic, adOpenDynamic

    'make updates in the record
    rs("Accept") = accept
    rs("Feature") = feature
    rs.Update

    ' if not accepted delete - if accepted copy to other table then delete
    if rs("Accept") = "False" then
    rs.delete
    else
    Set sqt = rs("Photo") & ", " & rs("Unm") & ", " & rs("IID") & ", " &
    rs("Title") & ", " & rs("Species") & ", " & _
    rs("Gender") & ", " & rs("PerchFly") & ", " & rs("Country") & ", " &
    rs("Region") & ", " & rs("Description") & ", " & _
    rs("Keywords") & ", " & rs("Feature") & ", " & rs("Entered") & ", "
    & rs("Accept")"

    Set sqlText = "INSERT INTO Table2 (" & sqt & _
    ")"
    rs.Open sqlText, conn
    rs.delete
    End if

    rs.close
    conn.close
    Response.Write "Record Updated"
    Response.Redirect "adminscreen.asp"

    %>
    Jeremy Guest

  2. Similar Questions and Discussions

    1. #39657 [NEW]: The extended table-specification "database.table" creates errors
      From: w dot kaiser at fortune dot de Operating system: XP Pro PHP version: 4.4.4 PHP Bug Type: MySQL related Bug...
    2. #39657 [Opn]: The extended table-specification "database.table" creates errors
      ID: 39657 User updated by: w dot kaiser at fortune dot de Reported By: w dot kaiser at fortune dot de Status: Open...
    3. Moving Randomly Moving Sprite To New Location on mouseEnter
      Hi All, This is way over my head. I am currently using Director 8. I have a randomly moving sprite(call it X) on stage (I accomplished this...
    4. supress errors at the page level? Undefined index errors.
      I'm creating a simple reply form, and if a form item isn't answered I get an error: "Notice: Undefined index: rb_amntspent in...
    5. Could not load type VTFixup Table from assembly Invalid token in v-table fix-up table.
      We are getting this error after clearing the web.config of database infomation - even after using the wizard to re-enter the information. I could...
  3. #2

    Default Re: moving from one table to another using asp [with errors]

    What do you mean by 'moving a record' and why do you want to 'move' it?

    David H

    Jeremy wrote:
    > I am having trouble moving a record from one table to another. I keep
    > getting the following error:
    >
    > Microsoft VBScript runtime error '800a01a8'
    > Object required: '[string: "rs('Photo') & ', ' &"]'
    > /photogallery/adminupdate.asp, line 27
    >
    > I've included my code. Anyone know what this error means & how to go
    > about remedying it? I'd appreciate any response!
    >
    > Thanks in advance!
    >
    > Jeremy
    >
    > <% LANGUAGE="VBScript"
    > const adOpenDynamic = 2
    > const adLockOptimistic = 3
    >
    > dim sqt
    >
    > 'capture form elements
    > accept = Request.form("accept")
    > feature = Request.form("feature")
    > key = Request.form("key")
    >
    > 'open database and get the record based upon the key
    > set conn = server.createobject("ADODB.Connection")
    > conn.Open("DSN=photo")
    > sqlText = "SELECT * FROM Table1 WHERE Photo = '" & key & "'"
    > Set rs = Server.CreateObject("ADODB.Recordset")
    > rs.Open sqlText, conn, adLockOptimistic, adOpenDynamic
    >
    > 'make updates in the record
    > rs("Accept") = accept
    > rs("Feature") = feature
    > rs.Update
    >
    > ' if not accepted delete - if accepted copy to other table then delete
    > if rs("Accept") = "False" then
    > rs.delete
    > else
    > Set sqt = rs("Photo") & ", " & rs("Unm") & ", " & rs("IID") & ", " &
    > rs("Title") & ", " & rs("Species") & ", " & _
    > rs("Gender") & ", " & rs("PerchFly") & ", " & rs("Country") & ", " &
    > rs("Region") & ", " & rs("Description") & ", " & _
    > rs("Keywords") & ", " & rs("Feature") & ", " & rs("Entered") & ", "
    > & rs("Accept")"
    >
    > Set sqlText = "INSERT INTO Table2 (" & sqt & _
    > ")"
    > rs.Open sqlText, conn
    > rs.delete
    > End if
    >
    > rs.close
    > conn.close
    > Response.Write "Record Updated"
    > Response.Redirect "adminscreen.asp"
    >
    > %>
    David C. Holley Guest

  4. #3

    Default Re: moving from one table to another using asp [with errors]

    > Set sqt = rs("Photo") & ", " & rs("Unm") & ", " & rs("IID") & ", " &
    ....
    > Set sqlText = "INSERT INTO Table2 (" & sqt & _
    Don't use SET to create strings!!!
    [url]http://www.aspfaq.com/2283[/url]

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)


    Aaron [SQL Server MVP] Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139