Me again Paul Whitham

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Me again Paul Whitham

    This should be easy, even for me, BUT
    I'm using the same code for the INSERT new retailer on another page INSERT
    new product.
    I have changed it slightly to insert the Session UserID instead of the
    Session ProductID
    Here's the code but i keep ketting this error:

    Microsoft JET Database Engine (0x80004005)
    Operation must use an updateable query.

    THE CODE:
    <%
    'Create a connection to your database
    dim strConn
    strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("../dbase_safe\brochure.mdb")
    'Read in the Retailers Table
    dim adoCn
    dim adoRs
    dim strSQL
    set adoCn=Server.CreateObject("ADODB.Connection")
    adoCn.Open strConn
    set adoRs=Server.CreateObject("ADODB.Recordset")
    strSQL="Select UserID from retailers"
    set adoRs=adoCn.Execute(strSQL)


    Do While not adoRs.EOF
    sUserID=adoRs ("UserID")


    'Carry out insert
    strSQL="Insert into Prices(productID,UserID) values ("& session("ProductID")
    & "," & sUserID &")"
    adoCn.Execute strSQL
    adoRS.MoveNext
    Loop

    adoRs.Close
    set adoRs=nothing
    adoCn.Close
    set adoCn=nothing
    %>



    Andy Guest

  2. Similar Questions and Discussions

    1. 99% there - FAQ Paul Whitham
      Hi Paul Please see my reply to one of my earlier posts called "FAO Nancy Gill" The page with you code on is now inserting one product after...
    2. FAO Paul Whitham
      Paul please see my last post re: Still struggling on this one. :-( Andy
    3. Attn. Paul Taylor
      Don't you hate it when people go "Attn. A Name" in the subject line. For a brief moment you think "oh oh, what have I done now" :-) Just...
  3. #2

    Default Re: Me again Paul Whitham

    Make sure you have the correct (at least Modify) permissions set on the
    folder in which your access database resides.

    HTH
    Rob
    [url]http://robgt.com/[/url]
    Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    Extensions: [url]http://robgt.com/products/index.asp[/url]


    RobGT Guest

  4. #3

    Default Re: Me again Paul Whitham

    Hi RobGT
    I'm sure the settings are ok because i have other pages updating the same
    database.
    Thanks for replying.

    Andy


    "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
    news:d5d4hf$98g$1@forums.macromedia.com...
    > Make sure you have the correct (at least Modify) permissions set on the
    > folder in which your access database resides.
    >
    > HTH
    > Rob
    > [url]http://robgt.com/[/url]
    > Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    > Extensions: [url]http://robgt.com/products/index.asp[/url]
    >
    >


    Andy Guest

  5. #4

    Default Re: Me again Paul Whitham

    It's possible then, if your other pages are working fine, that you are
    trying to perform an update on a database object that doesn't allow updates?

    What is the object you are trying to update?
    A table? Query?
    Cheers,
    Rob
    [url]http://robgt.com/[/url]
    Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    Extensions: [url]http://robgt.com/products/index.asp[/url]


    RobGT Guest

  6. #5

    Default Re: Me again Paul Whitham

    Hi RobGT
    On one page i have this code which works fine: It inserts all of the
    productID's into the new RetailerID

    <%
    'Create a connection to your database
    dim strConn
    strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("../dbase_safe\brochure.mdb")
    'Read in the Products Table
    dim adoCn
    dim adoRs
    dim strSQL
    set adoCn=Server.CreateObject("ADODB.Connection")
    adoCn.Open strConn
    set adoRs=Server.CreateObject("ADODB.Recordset")
    strSQL="Select ProductID from Products"
    set adoRs=adoCn.Execute(strSQL)


    Do While not adoRs.EOF
    sProductID=adoRs("productID")

    'Carry out insert
    strSQL="Insert into Prices(UserID,productID) values ("& session("UserID") &
    "," & sProductID &")"
    adoCn.Execute strSQL
    adoRS.MoveNext
    Loop

    adoRs.Close
    set adoRs=nothing
    adoCn.Close
    set adoCn=nothing
    %>

    I changed the code slightly so that when a new ProductID is inserted, it
    populates all of the retailers with the new productID: This is the code:

    <%
    'Create a connection to your database
    dim strConn
    strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("../dbase_safe\brochure.mdb")
    'Read in the Retailers Table
    dim adoCn
    dim adoRs
    dim strSQL
    set adoCn=Server.CreateObject("ADODB.Connection")
    adoCn.Open strConn
    set adoRs=Server.CreateObject("ADODB.Recordset")
    strSQL="Select UserID from retailers"
    set adoRs=adoCn.Execute(strSQL)


    Do While not adoRs.EOF
    sUserID=adoRs ("UserID")


    'Carry out insert
    strSQL="Insert into Prices(productID,UserID) values ("& session("ProductID")
    & "," & sUserID &")"
    adoCn.Execute strSQL
    adoRS.MoveNext
    Loop

    adoRs.Close
    set adoRs=nothing
    adoCn.Close
    set adoCn=nothing
    %>


    Thanks
    Andy





    "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
    news:d5dcdl$l4u$1@forums.macromedia.com...
    > It's possible then, if your other pages are working fine, that you are
    > trying to perform an update on a database object that doesn't allow
    > updates?
    >
    > What is the object you are trying to update?
    > A table? Query?
    > Cheers,
    > Rob
    > [url]http://robgt.com/[/url]
    > Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    > Extensions: [url]http://robgt.com/products/index.asp[/url]
    >
    >


    Andy Guest

  7. #6

    Default Re: Me again Paul Whitham

    Looking through your code, I can't really see anything wrong with it
    comparing the two code samples you posted.

    The one thing that first struck me was this line:

    adoRs ("UserID")

    Contains a space, it shouldn't.
    Now, that might be down to newsgroup formatting, or it might be your code??
    Double check that to be sure.

    Let me know if not and I'll try looking a little closer (it does seem ok to
    me though?)
    Cheers,
    Rob
    [url]http://robgt.com/[/url]
    Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    Extensions: [url]http://robgt.com/products/index.asp[/url]


    RobGT Guest

  8. #7

    Default Re: Me again Paul Whitham

    UserID is an Access reserved word and cannot be used as a field name.
    Change your query so that UserID is surrounded by brackets. "INSERT INTO
    Prices(ProductID, [UserID]) ..."

    "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
    news:d5cpnt$nsb$1@forums.macromedia.com...
    > This should be easy, even for me, BUT
    > I'm using the same code for the INSERT new retailer on another page INSERT
    > new product.
    > I have changed it slightly to insert the Session UserID instead of the
    > Session ProductID
    > Here's the code but i keep ketting this error:
    >
    > Microsoft JET Database Engine (0x80004005)
    > Operation must use an updateable query.
    >
    > THE CODE:
    > <%
    > 'Create a connection to your database
    > dim strConn
    > strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > Server.MapPath("../dbase_safe\brochure.mdb")
    > 'Read in the Retailers Table
    > dim adoCn
    > dim adoRs
    > dim strSQL
    > set adoCn=Server.CreateObject("ADODB.Connection")
    > adoCn.Open strConn
    > set adoRs=Server.CreateObject("ADODB.Recordset")
    > strSQL="Select UserID from retailers"
    > set adoRs=adoCn.Execute(strSQL)
    >
    >
    > Do While not adoRs.EOF
    > sUserID=adoRs ("UserID")
    >
    >
    > 'Carry out insert
    > strSQL="Insert into Prices(productID,UserID) values ("&
    > session("ProductID") & "," & sUserID &")"
    > adoCn.Execute strSQL
    > adoRS.MoveNext
    > Loop
    >
    > adoRs.Close
    > set adoRs=nothing
    > adoCn.Close
    > set adoCn=nothing
    > %>
    >
    >
    >

    Lionstone Guest

  9. #8

    Default Re: Me again Paul Whitham

    Ah-ha
    Access reserved words!
    Doh!

    Rob
    [url]http://robgt.com/[/url]
    Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    Extensions: [url]http://robgt.com/products/index.asp[/url]


    RobGT Guest

  10. #9

    Default Re: Me again Paul Whitham

    Hi Guys
    Sorry i haven't replied earlier, i've been a bit busy.

    Thanks for the tips, i'll give it a go later and report back.

    Thanks again

    Andy


    "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
    news:d5o1g0$247$1@forums.macromedia.com...
    > Ah-ha
    > Access reserved words!
    > Doh!
    >
    > Rob
    > [url]http://robgt.com/[/url]
    > Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    > Extensions: [url]http://robgt.com/products/index.asp[/url]
    >
    >


    Andy Guest

  11. #10

    Default Re: Me again Paul Whitham

    :-(

    Still no joy - i changed the code to:

    <%
    'Create a connection to your database
    dim strConn
    strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("../dbase_safe\brochure.mdb")
    'Read in the Products Table
    dim adoCn
    dim adoRs
    dim strSQL
    set adoCn=Server.CreateObject("ADODB.Connection")
    adoCn.Open strConn
    set adoRs=Server.CreateObject("ADODB.Recordset")
    strSQL="Select ProductID from Products"
    set adoRs=adoCn.Execute(strSQL)


    Do While not adoRs.EOF
    sProductID=adoRs("productID")

    'Carry out insert
    strSQL="Insert into Prices([UserID],productID) values ("& session("UserID")
    & "," & sProductID &")"
    adoCn.Execute strSQL
    adoRS.MoveNext
    Loop

    adoRs.Close
    set adoRs=nothing
    adoCn.Close
    set adoCn=nothing
    %>

    "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
    news:d5q8ia$aod$1@forums.macromedia.com...
    > Hi Guys
    > Sorry i haven't replied earlier, i've been a bit busy.
    >
    > Thanks for the tips, i'll give it a go later and report back.
    >
    > Thanks again
    >
    > Andy
    >
    >
    > "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
    > news:d5o1g0$247$1@forums.macromedia.com...
    >> Ah-ha
    >> Access reserved words!
    >> Doh!
    >>
    >> Rob
    >> [url]http://robgt.com/[/url]
    >> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    >> Extensions: [url]http://robgt.com/products/index.asp[/url]
    >>
    >>
    >
    >
    >
    >


    Andy Guest

  12. #11

    Default Re: Me again Paul Whitham

    I know that you said that UserID is a reserved word but i'm using it to
    insert the new retailer. See code below, which works.

    <%
    'Create a connection to your database
    dim strConn
    strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    Server.MapPath("../dbase_safe\brochure.mdb")
    'Read in the Products Table
    dim adoCn
    dim adoRs
    dim strSQL
    set adoCn=Server.CreateObject("ADODB.Connection")
    adoCn.Open strConn
    set adoRs=Server.CreateObject("ADODB.Recordset")
    strSQL="Select ProductID from Products"
    set adoRs=adoCn.Execute(strSQL)


    Do While not adoRs.EOF
    sProductID=adoRs("productID")

    'Carry out insert
    strSQL="Insert into Prices(UserID,productID) values ("& session("UserID") &
    "," & sProductID &")"
    adoCn.Execute strSQL
    adoRS.MoveNext
    Loop

    adoRs.Close
    set adoRs=nothing
    adoCn.Close
    set adoCn=nothing
    %>


    "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
    news:d5qf5s$kum$1@forums.macromedia.com...
    > :-(
    >
    > Still no joy - i changed the code to:
    >
    > <%
    > 'Create a connection to your database
    > dim strConn
    > strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > Server.MapPath("../dbase_safe\brochure.mdb")
    > 'Read in the Products Table
    > dim adoCn
    > dim adoRs
    > dim strSQL
    > set adoCn=Server.CreateObject("ADODB.Connection")
    > adoCn.Open strConn
    > set adoRs=Server.CreateObject("ADODB.Recordset")
    > strSQL="Select ProductID from Products"
    > set adoRs=adoCn.Execute(strSQL)
    >
    >
    > Do While not adoRs.EOF
    > sProductID=adoRs("productID")
    >
    > 'Carry out insert
    > strSQL="Insert into Prices([UserID],productID) values ("&
    > session("UserID") & "," & sProductID &")"
    > adoCn.Execute strSQL
    > adoRS.MoveNext
    > Loop
    >
    > adoRs.Close
    > set adoRs=nothing
    > adoCn.Close
    > set adoCn=nothing
    > %>
    >
    > "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
    > news:d5q8ia$aod$1@forums.macromedia.com...
    >> Hi Guys
    >> Sorry i haven't replied earlier, i've been a bit busy.
    >>
    >> Thanks for the tips, i'll give it a go later and report back.
    >>
    >> Thanks again
    >>
    >> Andy
    >>
    >>
    >> "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
    >> news:d5o1g0$247$1@forums.macromedia.com...
    >>> Ah-ha
    >>> Access reserved words!
    >>> Doh!
    >>>
    >>> Rob
    >>> [url]http://robgt.com/[/url]
    >>> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    >>> Extensions: [url]http://robgt.com/products/index.asp[/url]
    >>>
    >>>
    >>
    >>
    >>
    >>
    >
    >
    >
    >


    Andy Guest

  13. #12

    Default Re: Me again Paul Whitham

    Check that this is not a typo

    Server.MapPath("../dbase_safe\brochure.mdb")

    as it should be

    Server.MapPath("../dbase_safe/brochure.mdb")


    --
    Regards

    Paul Whitham
    Macromedia Certified Professional for Dreamweaver MX2004
    Valleybiz Internet Design
    [url]www.valleybiz.net[/url]

    Team Macromedia Volunteer for Ultradev/Dreamweaver MX
    [url]www.macromedia.com/support/forums/team_macromedia[/url]

    "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
    news:d5qffb$lch$1@forums.macromedia.com...
    > I know that you said that UserID is a reserved word but i'm using it to
    > insert the new retailer. See code below, which works.
    >
    > <%
    > 'Create a connection to your database
    > dim strConn
    > strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > Server.MapPath("../dbase_safe\brochure.mdb")
    > 'Read in the Products Table
    > dim adoCn
    > dim adoRs
    > dim strSQL
    > set adoCn=Server.CreateObject("ADODB.Connection")
    > adoCn.Open strConn
    > set adoRs=Server.CreateObject("ADODB.Recordset")
    > strSQL="Select ProductID from Products"
    > set adoRs=adoCn.Execute(strSQL)
    >
    >
    > Do While not adoRs.EOF
    > sProductID=adoRs("productID")
    >
    > 'Carry out insert
    > strSQL="Insert into Prices(UserID,productID) values ("& session("UserID")
    &
    > "," & sProductID &")"
    > adoCn.Execute strSQL
    > adoRS.MoveNext
    > Loop
    >
    > adoRs.Close
    > set adoRs=nothing
    > adoCn.Close
    > set adoCn=nothing
    > %>
    >
    >
    > "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
    > news:d5qf5s$kum$1@forums.macromedia.com...
    > > :-(
    > >
    > > Still no joy - i changed the code to:
    > >
    > > <%
    > > 'Create a connection to your database
    > > dim strConn
    > > strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    > > Server.MapPath("../dbase_safe\brochure.mdb")
    > > 'Read in the Products Table
    > > dim adoCn
    > > dim adoRs
    > > dim strSQL
    > > set adoCn=Server.CreateObject("ADODB.Connection")
    > > adoCn.Open strConn
    > > set adoRs=Server.CreateObject("ADODB.Recordset")
    > > strSQL="Select ProductID from Products"
    > > set adoRs=adoCn.Execute(strSQL)
    > >
    > >
    > > Do While not adoRs.EOF
    > > sProductID=adoRs("productID")
    > >
    > > 'Carry out insert
    > > strSQL="Insert into Prices([UserID],productID) values ("&
    > > session("UserID") & "," & sProductID &")"
    > > adoCn.Execute strSQL
    > > adoRS.MoveNext
    > > Loop
    > >
    > > adoRs.Close
    > > set adoRs=nothing
    > > adoCn.Close
    > > set adoCn=nothing
    > > %>
    > >
    > > "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
    > > news:d5q8ia$aod$1@forums.macromedia.com...
    > >> Hi Guys
    > >> Sorry i haven't replied earlier, i've been a bit busy.
    > >>
    > >> Thanks for the tips, i'll give it a go later and report back.
    > >>
    > >> Thanks again
    > >>
    > >> Andy
    > >>
    > >>
    > >> "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
    > >> news:d5o1g0$247$1@forums.macromedia.com...
    > >>> Ah-ha
    > >>> Access reserved words!
    > >>> Doh!
    > >>>
    > >>> Rob
    > >>> [url]http://robgt.com/[/url]
    > >>> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    > >>> Extensions: [url]http://robgt.com/products/index.asp[/url]
    > >>>
    > >>>
    > >>
    > >>
    > >>
    > >>
    > >
    > >
    > >
    > >
    >
    >
    >

    Paul Whitham TMM Guest

  14. #13

    Default Re: Me again Paul Whitham

    Hi paul

    Still no joy.

    Very strange

    Andy



    "Paul Whitham TMM" <paul@valleybiz.net> wrote in message
    news:d5rvet$pk$1@forums.macromedia.com...
    > Check that this is not a typo
    >
    > Server.MapPath("../dbase_safe\brochure.mdb")
    >
    > as it should be
    >
    > Server.MapPath("../dbase_safe/brochure.mdb")
    >
    >
    > --
    > Regards
    >
    > Paul Whitham
    > Macromedia Certified Professional for Dreamweaver MX2004
    > Valleybiz Internet Design
    > [url]www.valleybiz.net[/url]
    >
    > Team Macromedia Volunteer for Ultradev/Dreamweaver MX
    > [url]www.macromedia.com/support/forums/team_macromedia[/url]
    >
    > "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
    > news:d5qffb$lch$1@forums.macromedia.com...
    >> I know that you said that UserID is a reserved word but i'm using it to
    >> insert the new retailer. See code below, which works.
    >>
    >> <%
    >> 'Create a connection to your database
    >> dim strConn
    >> strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    >> Server.MapPath("../dbase_safe\brochure.mdb")
    >> 'Read in the Products Table
    >> dim adoCn
    >> dim adoRs
    >> dim strSQL
    >> set adoCn=Server.CreateObject("ADODB.Connection")
    >> adoCn.Open strConn
    >> set adoRs=Server.CreateObject("ADODB.Recordset")
    >> strSQL="Select ProductID from Products"
    >> set adoRs=adoCn.Execute(strSQL)
    >>
    >>
    >> Do While not adoRs.EOF
    >> sProductID=adoRs("productID")
    >>
    >> 'Carry out insert
    >> strSQL="Insert into Prices(UserID,productID) values ("& session("UserID")
    > &
    >> "," & sProductID &")"
    >> adoCn.Execute strSQL
    >> adoRS.MoveNext
    >> Loop
    >>
    >> adoRs.Close
    >> set adoRs=nothing
    >> adoCn.Close
    >> set adoCn=nothing
    >> %>
    >>
    >>
    >> "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
    >> news:d5qf5s$kum$1@forums.macromedia.com...
    >> > :-(
    >> >
    >> > Still no joy - i changed the code to:
    >> >
    >> > <%
    >> > 'Create a connection to your database
    >> > dim strConn
    >> > strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
    >> > Server.MapPath("../dbase_safe\brochure.mdb")
    >> > 'Read in the Products Table
    >> > dim adoCn
    >> > dim adoRs
    >> > dim strSQL
    >> > set adoCn=Server.CreateObject("ADODB.Connection")
    >> > adoCn.Open strConn
    >> > set adoRs=Server.CreateObject("ADODB.Recordset")
    >> > strSQL="Select ProductID from Products"
    >> > set adoRs=adoCn.Execute(strSQL)
    >> >
    >> >
    >> > Do While not adoRs.EOF
    >> > sProductID=adoRs("productID")
    >> >
    >> > 'Carry out insert
    >> > strSQL="Insert into Prices([UserID],productID) values ("&
    >> > session("UserID") & "," & sProductID &")"
    >> > adoCn.Execute strSQL
    >> > adoRS.MoveNext
    >> > Loop
    >> >
    >> > adoRs.Close
    >> > set adoRs=nothing
    >> > adoCn.Close
    >> > set adoCn=nothing
    >> > %>
    >> >
    >> > "Andy" <AndyjhughesNOSPAM@ntlworld.com> wrote in message
    >> > news:d5q8ia$aod$1@forums.macromedia.com...
    >> >> Hi Guys
    >> >> Sorry i haven't replied earlier, i've been a bit busy.
    >> >>
    >> >> Thanks for the tips, i'll give it a go later and report back.
    >> >>
    >> >> Thanks again
    >> >>
    >> >> Andy
    >> >>
    >> >>
    >> >> "RobGT" <rob@lighthouseuk.removeme.net> wrote in message
    >> >> news:d5o1g0$247$1@forums.macromedia.com...
    >> >>> Ah-ha
    >> >>> Access reserved words!
    >> >>> Doh!
    >> >>>
    >> >>> Rob
    >> >>> [url]http://robgt.com/[/url]
    >> >>> Tutorials: [url]http://robgt.com/tutorials/index.asp[/url]
    >> >>> Extensions: [url]http://robgt.com/products/index.asp[/url]
    >> >>>
    >> >>>
    >> >>
    >> >>
    >> >>
    >> >>
    >> >
    >> >
    >> >
    >> >
    >>
    >>
    >>
    >
    >
    >


    Andy 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