Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Re: dropdownlist proble

Re: dropdownlist proble

Scheduled Pinned Locked Moved ASP.NET
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    indian22
    wrote on last edited by
    #1

    I have tried but I don't whether I am right or wrong. Following is my coding : Page Load

    If Not (Page.IsPostBack) Then
    Dim dataSource As DataView

            'Retrieve item from cache if anything is not there then we have to add to the cache
    
    
            dataSource = Cache("CheDataSet")
    
            If dataSource Is Nothing Then
    
                Dim Conn As SqlConnection
                Dim Cmd As SqlDataAdapter
    
                'Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("con2"))
                Cmd = New SqlDataAdapter("select \* from tblcutomer2", myConnection)
    
                Dim ds As New DataSet
                Cmd.Fill(ds, "clientadd")
    
                dataSource = New DataView(ds.Tables("clientadd"))
                Cache("CheDataSet") = dataSource
    
                CacheMsg.Text = "Dataset was Created directly from the Datebase. Here the Cache was not used but the Cache was Created,so check for the performence next time."
            Else
    
                cacheMsg.Text = "Dataset was Retrieved from cache which was created earlier."
            End If
    
            ddlcus.DataSource = dataSource
            ddlcus.DataTextField = "clientname"
            ddlcus.DataValueField = "intcustid"
    
            ddlcus.DataBind()
            ddlcus.Items.Insert(0, "-Select-")
        End If
    

    Selected Index event:

    Dim cmd As New SqlCommand("select intcustid,clientadd as address from tblcutomer2 where intcustid='" & ddlcus.SelectedItem.Value & "' ", myConnection)
    myConnection.Open()
    Dim myDataReader As SqlDataReader
    myDataReader = cmd.ExecuteReader()
    While (myDataReader.Read()) = True

            txtcusadd.Text = myDataReader("address")
        End While
        myDataReader.Close()
        myConnection.Close()
    

    But it takes more time to display address of the selected customer.Can you plz suggest me to reduce the time

    Y 1 Reply Last reply
    0
    • I indian22

      I have tried but I don't whether I am right or wrong. Following is my coding : Page Load

      If Not (Page.IsPostBack) Then
      Dim dataSource As DataView

              'Retrieve item from cache if anything is not there then we have to add to the cache
      
      
              dataSource = Cache("CheDataSet")
      
              If dataSource Is Nothing Then
      
                  Dim Conn As SqlConnection
                  Dim Cmd As SqlDataAdapter
      
                  'Dim myConnection As New SqlConnection(ConfigurationSettings.AppSettings("con2"))
                  Cmd = New SqlDataAdapter("select \* from tblcutomer2", myConnection)
      
                  Dim ds As New DataSet
                  Cmd.Fill(ds, "clientadd")
      
                  dataSource = New DataView(ds.Tables("clientadd"))
                  Cache("CheDataSet") = dataSource
      
                  CacheMsg.Text = "Dataset was Created directly from the Datebase. Here the Cache was not used but the Cache was Created,so check for the performence next time."
              Else
      
                  cacheMsg.Text = "Dataset was Retrieved from cache which was created earlier."
              End If
      
              ddlcus.DataSource = dataSource
              ddlcus.DataTextField = "clientname"
              ddlcus.DataValueField = "intcustid"
      
              ddlcus.DataBind()
              ddlcus.Items.Insert(0, "-Select-")
          End If
      

      Selected Index event:

      Dim cmd As New SqlCommand("select intcustid,clientadd as address from tblcutomer2 where intcustid='" & ddlcus.SelectedItem.Value & "' ", myConnection)
      myConnection.Open()
      Dim myDataReader As SqlDataReader
      myDataReader = cmd.ExecuteReader()
      While (myDataReader.Read()) = True

              txtcusadd.Text = myDataReader("address")
          End While
          myDataReader.Close()
          myConnection.Close()
      

      But it takes more time to display address of the selected customer.Can you plz suggest me to reduce the time

      Y Offline
      Y Offline
      Yusuf
      wrote on last edited by
      #2

      First: this seems a fellow up post. Please don't start new post. This will not make your issue clear to people. I have to dig out to find what what your first post, here[^] I found it.

      indian22 wrote:

      But it takes more time to display address of the selected customer

      Look, you are trying to load 10000 into drop down. Of course it will take time.

      indian22 wrote:

      Can you plz suggest me to reduce the time

      What is the need to show that much data into a drop down. Can you reduce the amount to show. Even if you could load all, imagine scrolling through all that data.

      Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups