如何从超大数据表中填充下拉列表? [英] how to fill dropdown list from extra huge datatable?
本文介绍了如何从超大数据表中填充下拉列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有数据库表,此表在我的asp页中有400000行,我的下拉列表(ddlPlaintiffName)通过此方法填充
i have table from database this table has 400000 row in my asp page my dropdown list(ddlPlaintiffName) fill from this method
private void FillPlaintiff()
{
//declare connection by pass connection string from web.config
SqlConnection sqlcon = new SqlConnection
(ConfigurationManager.ConnectionStrings["SystemConn"].ConnectionString);
//declare sql statment as astring variable
SqlCommand sqlcom = new SqlCommand();
sqlcom.Connection = sqlcon;
sqlcom.CommandType = CommandType.StoredProcedure;
sqlcom.CommandText = "proc_SelectPlaintiff";
DataTable ds = new DataTable();
//fill data set with data adabter that contain data from database
// sad.Fill(ds);
sqlcon.Open();
SqlDataAdapter sad = new SqlDataAdapter(sqlcom);
sad.Fill(ds);
ddlPlaintiffName.DataSource = ds;
ddlPlaintiffName.DataBind();
ddlPlaintiffName.Items.Insert(0, "--select --");
sqlcon.Close();
}
但是每次回发时,我的负载都非常缓慢,如何避免这种情况
but every postback my load is very very slow how can i avoid this
推荐答案
简单的解决方案是:不要这样做.
从用户的角度考虑它:您尝试从40万项下拉列表中找到所需的项.
如果简单吗?快的?容易吗?
提供弹出窗口,过滤器或其他工具,以简化生活.
您所提议的内容几乎旨在阻止用户使用您的软件.
The simple solution is: Don''t do it.
Think of it from your user''s point of view: You try and find the one item you are looking for in a drop down of 400,000 items.
If it simple? Quick? Easy?
Provide a popup, or a filter, or something to make their lives easier.
What you are proposing is almost designed to discourage users from using your software.
正如Griff所说,将大量数据放入下拉列表中是没有用的.无论如何,用户将无法处理它.我会使用自动完成扩展文本框 [
As Griff stated, it is no use putting so much data in a dropdown. The user won''t be able ho handle it anyway. I would use an autocomplete extended textbox[^] plus a validation of course, if the options can be filtered directly.
But I can not imagine what can have that much options, so I suppose a single dropdown/autocomplete won''t be enough from usability point of view.
这篇关于如何从超大数据表中填充下拉列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文