One SQL, two conns

Discussion in 'ASP General' started by Stuart Palmer, Aug 29, 2004.

  1. Hi There,
    I'm writing an ASP cart and hit a problem.

    I have 2 db's, one is products, one is cart contents.

    Cart contents holds the unique ID from products when you do your 'basket'.

    When I display the basket, I want to display the products name from the
    products DB based on the ID stated in the cart DB

    I have been informed I can do this with SQL some how, but that means I'd
    have to create two conn objects? or can it be done another way?

    Thx for the advise.

    Stu
     
    Stuart Palmer, Aug 29, 2004
    #1
    1. Advertising

  2. You can put the first recordset in an array, then get the second

    "Stuart Palmer" <> wrote in message
    news:_leYc.9$...
    > Hi There,
    > I'm writing an ASP cart and hit a problem.
    >
    > I have 2 db's, one is products, one is cart contents.
    >
    > Cart contents holds the unique ID from products when you do your 'basket'.
    >
    > When I display the basket, I want to display the products name from the
    > products DB based on the ID stated in the cart DB
    >
    > I have been informed I can do this with SQL some how, but that means I'd
    > have to create two conn objects? or can it be done another way?
    >
    > Thx for the advise.
    >
    > Stu
    >
    >
     
    Pauline Parrot, Aug 29, 2004
    #2
    1. Advertising

  3. Stuart Palmer

    Harag Guest

    On Sun, 29 Aug 2004 06:04:42 GMT, "Stuart Palmer"
    <> wrote:

    >Hi There,
    >I'm writing an ASP cart and hit a problem.
    >
    >I have 2 db's, one is products, one is cart contents.
    >
    >Cart contents holds the unique ID from products when you do your 'basket'.
    >
    >When I display the basket, I want to display the products name from the
    >products DB based on the ID stated in the cart DB
    >
    >I have been informed I can do this with SQL some how, but that means I'd
    >have to create two conn objects? or can it be done another way?
    >
    >Thx for the advise.
    >
    >Stu
    >


    2 DBs or 2 tables in 1 DB ?
    what DB are you using access?

    for SQL (as I've never used access) you would join the 2 tables
    together to get the result. since I don't know your Table layouts
    (Provide DDL) I'm just guessing.

    SELECT p.ProdID, p.ProdName, b.Quantity, p.Price, (b.Quantity*p.Price)
    as Total
    FROM basket b INNER JOIN
    Products p ON b.ProdID = p.ProdID
    WHERE b.MemberID = 23 -- user number of logged in person.


    HTH.

    Al.
     
    Harag, Aug 29, 2004
    #3
  4. Stuart,

    A good practice is to connect to only one database, and take advantage of
    connection pooling. You can create views in your product table, to the
    tables within cart database. This way, you can just connect to one database.

    --
    Manohar Kamath
    Editor, .netWire
    www.dotnetwire.com


    "Stuart Palmer" <> wrote in message
    news:_leYc.9$...
    > Hi There,
    > I'm writing an ASP cart and hit a problem.
    >
    > I have 2 db's, one is products, one is cart contents.
    >
    > Cart contents holds the unique ID from products when you do your 'basket'.
    >
    > When I display the basket, I want to display the products name from the
    > products DB based on the ID stated in the cart DB
    >
    > I have been informed I can do this with SQL some how, but that means I'd
    > have to create two conn objects? or can it be done another way?
    >
    > Thx for the advise.
    >
    > Stu
    >
    >
     
    Manohar Kamath [MVP], Aug 29, 2004
    #4
  5. Hi Harag,
    Thx for the info, I know about Joining two tables in a DB together, but
    I have two seperate MDB files (Yes, access. I don't have SQL server :eek:( ).
    Have you opened two SQL Server Db's at the same time and managed to get
    data from each? (A kind of JOIN but for mbd queries)

    Thx
    Stu

    "Harag" <> wrote in message
    news:...
    > On Sun, 29 Aug 2004 06:04:42 GMT, "Stuart Palmer"
    > <> wrote:
    >
    > >Hi There,
    > >I'm writing an ASP cart and hit a problem.
    > >
    > >I have 2 db's, one is products, one is cart contents.
    > >
    > >Cart contents holds the unique ID from products when you do your

    'basket'.
    > >
    > >When I display the basket, I want to display the products name from the
    > >products DB based on the ID stated in the cart DB
    > >
    > >I have been informed I can do this with SQL some how, but that means I'd
    > >have to create two conn objects? or can it be done another way?
    > >
    > >Thx for the advise.
    > >
    > >Stu
    > >

    >
    > 2 DBs or 2 tables in 1 DB ?
    > what DB are you using access?
    >
    > for SQL (as I've never used access) you would join the 2 tables
    > together to get the result. since I don't know your Table layouts
    > (Provide DDL) I'm just guessing.
    >
    > SELECT p.ProdID, p.ProdName, b.Quantity, p.Price, (b.Quantity*p.Price)
    > as Total
    > FROM basket b INNER JOIN
    > Products p ON b.ProdID = p.ProdID
    > WHERE b.MemberID = 23 -- user number of logged in person.
    >
    >
    > HTH.
    >
    > Al.
    >
    >
    >
     
    Stuart Palmer, Aug 29, 2004
    #5
  6. Thx,
    I think I understadn what you mean, but I am not quite understanding.
    I have MDB db's. Are you saying I should be able to somehow add something to
    the products MDB to state that I want it to connect to the other in some
    manner?

    Do you have a link to anything on the web that might be able to explain this
    better? I have looked up connection pooling on the www but it offers me no
    example (code/process for me to do this except enabling and disabling
    it....which is done on the server (my Host won't let me do this I don't
    think :eek:( )

    Thx again
    Stu

    "Manohar Kamath [MVP]" <> wrote in message
    news:...
    > Stuart,
    >
    > A good practice is to connect to only one database, and take advantage of
    > connection pooling. You can create views in your product table, to the
    > tables within cart database. This way, you can just connect to one

    database.
    >
    > --
    > Manohar Kamath
    > Editor, .netWire
    > www.dotnetwire.com
    >
    >
    > "Stuart Palmer" <> wrote in message
    > news:_leYc.9$...
    > > Hi There,
    > > I'm writing an ASP cart and hit a problem.
    > >
    > > I have 2 db's, one is products, one is cart contents.
    > >
    > > Cart contents holds the unique ID from products when you do your

    'basket'.
    > >
    > > When I display the basket, I want to display the products name from the
    > > products DB based on the ID stated in the cart DB
    > >
    > > I have been informed I can do this with SQL some how, but that means I'd
    > > have to create two conn objects? or can it be done another way?
    > >
    > > Thx for the advise.
    > >
    > > Stu
    > >
    > >

    >
    >
     
    Stuart Palmer, Aug 29, 2004
    #6
  7. Look up "linked tables" in Access online help.

    Bob Barrows
    Stuart Palmer wrote:
    > Thx,
    > I think I understadn what you mean, but I am not quite understanding.
    > I have MDB db's. Are you saying I should be able to somehow add
    > something to the products MDB to state that I want it to connect to
    > the other in some manner?
    >
    > Do you have a link to anything on the web that might be able to
    > explain this better? I have looked up connection pooling on the www
    > but it offers me no example (code/process for me to do this except
    > enabling and disabling it....which is done on the server (my Host
    > won't let me do this I don't think :eek:( )
    >
    > Thx again
    > Stu
    >
    > "Manohar Kamath [MVP]" <> wrote in
    > message news:...
    >> Stuart,
    >>
    >> A good practice is to connect to only one database, and take
    >> advantage of connection pooling. You can create views in your
    >> product table, to the tables within cart database. This way, you can
    >> just connect to one database.
    >>
    >> --
    >> Manohar Kamath
    >> Editor, .netWire
    >> www.dotnetwire.com
    >>
    >>
    >> "Stuart Palmer" <> wrote in message
    >> news:_leYc.9$...
    >>> Hi There,
    >>> I'm writing an ASP cart and hit a problem.
    >>>
    >>> I have 2 db's, one is products, one is cart contents.
    >>>
    >>> Cart contents holds the unique ID from products when you do your
    >>> 'basket'.
    >>>
    >>> When I display the basket, I want to display the products name from
    >>> the products DB based on the ID stated in the cart DB
    >>>
    >>> I have been informed I can do this with SQL some how, but that
    >>> means I'd have to create two conn objects? or can it be done
    >>> another way?
    >>>
    >>> Thx for the advise.
    >>>
    >>> Stu


    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Aug 29, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DC Gringo
    Replies:
    2
    Views:
    2,311
    Nikhil Patel
    Feb 26, 2004
  2. news.frontiernet.net
    Replies:
    6
    Views:
    1,133
    news.frontiernet.net
    Apr 16, 2004
  3. GenxLogic
    Replies:
    3
    Views:
    1,294
    andrewmcdonagh
    Dec 6, 2006
  4. ecoolone
    Replies:
    0
    Views:
    775
    ecoolone
    Jan 3, 2008
  5. Tyrone Slothrop

    One Form, Two Targets, Two Actions

    Tyrone Slothrop, Dec 28, 2006, in forum: Javascript
    Replies:
    5
    Views:
    160
    Jonas Raoni
    Dec 29, 2006
Loading...

Share This Page