How to prevent loading data from database more than once?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • antonyliu2002@yahoo.com

    How to prevent loading data from database more than once?

    I load data from a database to populate a ListBox in Page_Load in my VB
    script.

    Apparently, each time the page is visited the ListBox gets repopulated.

    How do I stop it from connecting to the database and obtaining the data
    to populate the list box if the list box is already populated?

    Thanks.

  • Elton Wang

    #2
    Re: How to prevent loading data from database more than once?

    If Not IsPostback Then
    ' populate the ListBox
    End If

    HTH

    <antonyliu2002@ yahoo.com> wrote in message
    news:1128973936 .777415.9880@g4 4g2000cwa.googl egroups.com...[color=blue]
    >I load data from a database to populate a ListBox in Page_Load in my VB
    > script.
    >
    > Apparently, each time the page is visited the ListBox gets repopulated.
    >
    > How do I stop it from connecting to the database and obtaining the data
    > to populate the list box if the list box is already populated?
    >
    > Thanks.
    >[/color]


    Comment

    • antonyliu2002@yahoo.com

      #3
      Re: How to prevent loading data from database more than once?

      Hey, Elton,

      That sounds easy. I got it. Thanks a lot!


      Elton Wang wrote:[color=blue]
      > If Not IsPostback Then
      > ' populate the ListBox
      > End If
      >
      > HTH
      >
      > <antonyliu2002@ yahoo.com> wrote in message
      > news:1128973936 .777415.9880@g4 4g2000cwa.googl egroups.com...[color=green]
      > >I load data from a database to populate a ListBox in Page_Load in my VB
      > > script.
      > >
      > > Apparently, each time the page is visited the ListBox gets repopulated.
      > >
      > > How do I stop it from connecting to the database and obtaining the data
      > > to populate the list box if the list box is already populated?
      > >
      > > Thanks.
      > >[/color][/color]

      Comment

      Working...