Re: dropdownlist proble
-
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()) = Truetxtcusadd.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
-
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()) = Truetxtcusadd.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
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[^]