reuse SQLDataReader in multiple dropdownlists?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Craig Buchanan

    reuse SQLDataReader in multiple dropdownlists?

    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\)

    #2
    Re: reuse SQLDataReader in multiple dropdownlists?

    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" <someone@somewh ere.com> wrote in message
    news:eKWCsTR2DH A.3016@TK2MSFTN GP09.phx.gbl...[color=blue]
    > I would like to reuse a SQLDataReader that is populated with information[/color]
    as[color=blue]
    > 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
    >
    >[/color]


    Comment

    • Mark Fitzpatrick

      #3
      Re: reuse SQLDataReader in multiple dropdownlists?

      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)" <NoSpamMgbworld @comcast.netNoS pamM> wrote in
      message news:O758e0R2DH A.4060@TK2MSFTN GP11.phx.gbl...[color=blue]
      > 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" <someone@somewh ere.com> wrote in message
      > news:eKWCsTR2DH A.3016@TK2MSFTN GP09.phx.gbl...[color=green]
      > > I would like to reuse a SQLDataReader that is populated with information[/color]
      > as[color=green]
      > > 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
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Steve C. Orr [MVP, MCSD]

        #4
        Re: reuse SQLDataReader in multiple dropdownlists?

        Another solution is that you can bind your second DDL to your first.

        --
        I hope this helps,
        Steve C. Orr, MCSD, MVP

        Hire top-notch developers at http://www.able-consulting.com



        "Craig Buchanan" <someone@somewh ere.com> wrote in message
        news:eKWCsTR2DH A.3016@TK2MSFTN GP09.phx.gbl...[color=blue]
        > I would like to reuse a SQLDataReader that is populated with information[/color]
        as[color=blue]
        > 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
        >
        >[/color]


        Comment

        • Craig Buchanan

          #5
          Re: reuse SQLDataReader in multiple dropdownlists?

          how is this done? the datasource is write only.

          thanks,

          craig

          "Steve C. Orr [MVP, MCSD]" <Steve@Orr.ne t> wrote in message
          news:uAWuHyS2DH A.1908@TK2MSFTN GP10.phx.gbl...[color=blue]
          > 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" <someone@somewh ere.com> wrote in message
          > news:eKWCsTR2DH A.3016@TK2MSFTN GP09.phx.gbl...[color=green]
          > > I would like to reuse a SQLDataReader that is populated with information[/color]
          > as[color=green]
          > > 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
          > >
          > >[/color]
          >
          >[/color]


          Comment

          Working...