99% there - FAQ Paul Whitham

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

  1. #1

    Default 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 inserting the
    new retailer.
    Why isn't it inserting all of them ?

    Andy



    Andy Guest

  2. Similar Questions and Discussions

    1. 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...
    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: 99% there - FAQ Paul Whitham

    > Why isn't it inserting all of them ?

    Sounds like you didn't loop it. A repeat region perhaps?
    I didn't see the code he sent you .. but that's a thought.

    Nancy



    Nancy Gill Guest

  4. #3

    Default Re: 99% there - FAQ Paul Whitham

    Sorry nancy i know i'm being a pain!

    Here is the code:


    <%
    'Create a connection to your database
    dim strConn
    strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=E:\work\websites\dynamic_brochure\dbase_saf e\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, Price from Prices"
    set adoRs=adoCn.Execute(strSQL)


    If not adoRs.EOF then
    sProductID=adoRs("productID")
    sPrice=adoRs("Price")

    'Carry out inseert
    strSQL="Insert into Prices(UserID,productID,Price) values ("&
    session("UserID") & "," & sProductID &"," & sPrice & ")"
    adoCn.Execute strSQL
    End If
    adoRs.Close
    set adoRs=nothing
    adoCn.Close
    set adoCn=nothing
    %>


    "Nancy Gill" <nancy@webwish.com> wrote in message
    news:d57tnm$ihc$1@forums.macromedia.com...
    >
    >> Why isn't it inserting all of them ?
    >
    >
    > Sounds like you didn't loop it. A repeat region perhaps?
    > I didn't see the code he sent you .. but that's a thought.
    >
    > Nancy
    >
    >
    >
    >


    Andy Guest

  5. #4

    Default Re: 99% there - FAQ Paul Whitham

    Andy

    Slight error in the insert code. Try this

    <%
    'Create a connection to your database
    dim strConn
    strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=E:\work\websites\dynamic_brochure\dbase_saf e\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, Price from Prices"
    set adoRs=adoCn.Execute(strSQL)


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

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

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

    --
    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:d587jo$4eb$1@forums.macromedia.com...
    > Sorry nancy i know i'm being a pain!
    >
    > Here is the code:
    >
    >
    > >
    >
    > "Nancy Gill" <nancy@webwish.com> wrote in message
    > news:d57tnm$ihc$1@forums.macromedia.com...
    > >
    > >> Why isn't it inserting all of them ?
    > >
    > >
    > > Sounds like you didn't loop it. A repeat region perhaps?
    > > I didn't see the code he sent you .. but that's a thought.
    > >
    > > Nancy
    > >
    > >
    > >
    > >
    >
    >
    >

    Paul Whitham TMM Guest

  6. #5

    Default Re: 99% there - FAQ Paul Whitham

    Oooooo Sooo close

    Hi Paul

    This is getting very exciting now :-) thanks to you.

    What's happening now is that when i create a new retailer, he/she is
    assigned mulitple occurances of the same product. All products seem to be
    assigned, it's just that each product is there numerous times.

    There ae about 450 products, but when i checked the database, over 62,000
    products were inserted for the new retailer.

    I can smell the light at the end of the tunnel - errr!

    Thanks
    Andy



    "Paul Whitham TMM" <paul@valleybiz.net> wrote in message
    news:d59a9k$k9g$1@forums.macromedia.com...
    > Andy
    >
    > Slight error in the insert code. Try this
    >
    > <%
    > 'Create a connection to your database
    > dim strConn
    > strConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data
    > Source=E:\work\websites\dynamic_brochure\dbase_saf e\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, Price from Prices"
    > set adoRs=adoCn.Execute(strSQL)
    >
    >
    > Do While not adoRs.EOF
    > sProductID=adoRs("productID")
    > sPrice=adoRs("Price")
    >
    > 'Carry out inseert
    > strSQL="Insert into Prices(UserID,productID,Price) values ("&
    > session("UserID") & "," & sProductID &"," & sPrice & ")"
    > adoCn.Execute strSQL
    > adoRS.MoveNext
    > Loop
    >
    > adoRs.Close
    > set adoRs=nothing
    > adoCn.Close
    > set adoCn=nothing
    > %>
    >
    > --
    > 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:d587jo$4eb$1@forums.macromedia.com...
    >> Sorry nancy i know i'm being a pain!
    >>
    >> Here is the code:
    >>
    >>
    >> >
    >>
    >> "Nancy Gill" <nancy@webwish.com> wrote in message
    >> news:d57tnm$ihc$1@forums.macromedia.com...
    >> >
    >> >> Why isn't it inserting all of them ?
    >> >
    >> >
    >> > Sounds like you didn't loop it. A repeat region perhaps?
    >> > I didn't see the code he sent you .. but that's a thought.
    >> >
    >> > Nancy
    >> >
    >> >
    >> >
    >> >
    >>
    >>
    >>
    >
    >
    >


    Andy Guest

  7. #6

    Default Re: 99% there - FAQ Paul Whitham

    i may not know much about coding or even about what your coding but in this
    paragraph shouldnt the insert be spelt with one E?
    'Carry out inseert
    strSQL="Insert into Prices(UserID,productID,Price) values ("&
    session("UserID") & "," & sProductID &"," & sPrice & ")"
    adoCn.Execute strSQL
    End If
    adoRs.Close
    set adoRs=nothing
    adoCn.Close
    set adoCn=nothing
    %>


    mysteriousmongoose Guest

  8. #7

    Default Re: 99% there - FAQ Paul Whitham

    Thanks Mysteriousmongoose ?

    It would make a difference if it were the actual code, but it's just a
    comment.

    Thanks anyway :-)

    Andy

    "mysteriousmongoose" <webforumsuser@macromedia.com> wrote in message
    news:d5a2hs$l3g$1@forums.macromedia.com...
    >i may not know much about coding or even about what your coding but in this
    > paragraph shouldnt the insert be spelt with one E?
    > 'Carry out inseert
    > strSQL="Insert into Prices(UserID,productID,Price) values ("&
    > session("UserID") & "," & sProductID &"," & sPrice & ")"
    > adoCn.Execute strSQL
    > End If
    > adoRs.Close
    > set adoRs=nothing
    > adoCn.Close
    > set adoCn=nothing
    > %>
    >
    >
    >


    Andy Guest

  9. #8

    Default Re: 99% there - FAQ Paul Whitham

    Hi Paul

    Just wanted to thank you for your patience and help.
    The page is now working :-) :-) :-)

    I changed the code very slightly which stopped it inserting too many
    records. The code below shows the slight change:

    I'm sure this code will help with other projects in the future.

    Kind Regards and Thanks again

    Andy

    <%
    '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:d5a3ka$mlb$1@forums.macromedia.com...
    > Thanks Mysteriousmongoose ?
    >
    > It would make a difference if it were the actual code, but it's just a
    > comment.
    >
    > Thanks anyway :-)
    >
    > Andy
    >
    > "mysteriousmongoose" <webforumsuser@macromedia.com> wrote in message
    > news:d5a2hs$l3g$1@forums.macromedia.com...
    >>i may not know much about coding or even about what your coding but in
    >>this
    >> paragraph shouldnt the insert be spelt with one E?
    >> 'Carry out inseert
    >> strSQL="Insert into Prices(UserID,productID,Price) values ("&
    >> session("UserID") & "," & sProductID &"," & sPrice & ")"
    >> adoCn.Execute strSQL
    >> End If
    >> adoRs.Close
    >> set adoRs=nothing
    >> adoCn.Close
    >> set adoCn=nothing
    >> %>
    >>
    >>
    >>
    >
    >
    >
    >


    Andy Guest

  10. #9

    Default Re: 99% there - FAQ Paul Whitham

    Andy

    Only too happy to be off help.

    --
    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:d5abnr$51c$1@forums.macromedia.com...
    > Hi Paul
    >
    > Just wanted to thank you for your patience and help.
    > The page is now working :-) :-) :-)
    >
    > I changed the code very slightly which stopped it inserting too many
    > records. The code below shows the slight change:
    >
    > I'm sure this code will help with other projects in the future.
    >
    > Kind Regards and Thanks again
    >
    > Andy
    >
    > <%
    > '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:d5a3ka$mlb$1@forums.macromedia.com...
    > > Thanks Mysteriousmongoose ?
    > >
    > > It would make a difference if it were the actual code, but it's just a
    > > comment.
    > >
    > > Thanks anyway :-)
    > >
    > > Andy
    > >
    > > "mysteriousmongoose" <webforumsuser@macromedia.com> wrote in message
    > > news:d5a2hs$l3g$1@forums.macromedia.com...
    > >>i may not know much about coding or even about what your coding but in
    > >>this
    > >> paragraph shouldnt the insert be spelt with one E?
    > >> 'Carry out inseert
    > >> strSQL="Insert into Prices(UserID,productID,Price) values ("&
    > >> session("UserID") & "," & sProductID &"," & sPrice & ")"
    > >> adoCn.Execute strSQL
    > >> End If
    > >> adoRs.Close
    > >> set adoRs=nothing
    > >> adoCn.Close
    > >> set adoCn=nothing
    > >> %>
    > >>
    > >>
    > >>
    > >
    > >
    > >
    > >
    >
    >
    >

    Paul Whitham TMM Guest

  11. #10

    Default Re: 99% there - FAQ Paul Whitham

    yay it says insert! :)
    mysteriousmongoose 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