reuse SQLDataReader in multiple dropdownlists?

Discussion in 'ASP .Net' started by Craig Buchanan, Jan 12, 2004.

  1. I would like to reuse a SQLDataReader that is populated with information as
    the datasource for multiple dropdownlists. Unfortunately, the first DDL
    closes the SDR and my code fails on the second DDR. Is there a way to
    copy/clone the SDR? Is there another solution?

    Thanks,

    Craig Buchanan
     
    Craig Buchanan, Jan 12, 2004
    #1
    1. Advertising

  2. DataSet. Can bind to as many controls as you wish.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    **********************************************************************
    Think Outside the Box!
    **********************************************************************
    "Craig Buchanan" <> wrote in message
    news:...
    > I would like to reuse a SQLDataReader that is populated with information

    as
    > the datasource for multiple dropdownlists. Unfortunately, the first DDL
    > closes the SDR and my code fails on the second DDR. Is there a way to
    > copy/clone the SDR? Is there another solution?
    >
    > Thanks,
    >
    > Craig Buchanan
    >
    >
     
    Cowboy \(Gregory A. Beamer\), Jan 12, 2004
    #2
    1. Advertising

  3. Not to mention it's disconnected. DataReaders keep an open connection to the
    database so re-using the same DataReader will waste a lot of bandwidth and
    server time fetching the rows again and again. The DataSet (or DataTables
    for that matter) fetch all the results and then close the connection. Much
    more efficient if you are using the data repeatedly and much nicer on the
    database.

    Hope this helps
    Mark Fitzpatrick
    Microsoft MVP - FrontPage

    "Cowboy (Gregory A. Beamer)" <> wrote in
    message news:...
    > DataSet. Can bind to as many controls as you wish.
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    >
    > **********************************************************************
    > Think Outside the Box!
    > **********************************************************************
    > "Craig Buchanan" <> wrote in message
    > news:...
    > > I would like to reuse a SQLDataReader that is populated with information

    > as
    > > the datasource for multiple dropdownlists. Unfortunately, the first DDL
    > > closes the SDR and my code fails on the second DDR. Is there a way to
    > > copy/clone the SDR? Is there another solution?
    > >
    > > Thanks,
    > >
    > > Craig Buchanan
    > >
    > >

    >
    >
     
    Mark Fitzpatrick, Jan 12, 2004
    #3
  4. Another solution is that you can bind your second DDL to your first.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP
    http://Steve.Orr.net
    Hire top-notch developers at http://www.able-consulting.com



    "Craig Buchanan" <> wrote in message
    news:...
    > I would like to reuse a SQLDataReader that is populated with information

    as
    > the datasource for multiple dropdownlists. Unfortunately, the first DDL
    > closes the SDR and my code fails on the second DDR. Is there a way to
    > copy/clone the SDR? Is there another solution?
    >
    > Thanks,
    >
    > Craig Buchanan
    >
    >
     
    Steve C. Orr [MVP, MCSD], Jan 12, 2004
    #4
  5. how is this done? the datasource is write only.

    thanks,

    craig

    "Steve C. Orr [MVP, MCSD]" <> wrote in message
    news:...
    > Another solution is that you can bind your second DDL to your first.
    >
    > --
    > I hope this helps,
    > Steve C. Orr, MCSD, MVP
    > http://Steve.Orr.net
    > Hire top-notch developers at http://www.able-consulting.com
    >
    >
    >
    > "Craig Buchanan" <> wrote in message
    > news:...
    > > I would like to reuse a SQLDataReader that is populated with information

    > as
    > > the datasource for multiple dropdownlists. Unfortunately, the first DDL
    > > closes the SDR and my code fails on the second DDR. Is there a way to
    > > copy/clone the SDR? Is there another solution?
    > >
    > > Thanks,
    > >
    > > Craig Buchanan
    > >
    > >

    >
    >
     
    Craig Buchanan, Jan 15, 2004
    #5
    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. tshad
    Replies:
    5
    Views:
    549
    Steve C. Orr [MVP, MCSD]
    May 17, 2005
  2. Hylander

    To reuse or not to reuse....

    Hylander, Feb 26, 2004, in forum: Java
    Replies:
    0
    Views:
    427
    Hylander
    Feb 26, 2004
  3. code reuse and design reuse

    , Feb 7, 2006, in forum: C Programming
    Replies:
    16
    Views:
    1,040
    Malcolm
    Feb 12, 2006
  4. jacob navia

    To reuse or not to reuse

    jacob navia, Nov 5, 2006, in forum: C Programming
    Replies:
    19
    Views:
    545
    Dave Thompson
    Dec 18, 2006
  5. Cirene

    How to reuse sqldatareader?

    Cirene, May 27, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    4,902
    Cirene
    May 27, 2008
Loading...

Share This Page