如何在页面加载时加载所有数据并创建一个temproary表,这是一个挑战 [英] how to load all the data on page load and create a temproary table, a challenge

查看:120
本文介绍了如何在页面加载时加载所有数据并创建一个temproary表,这是一个挑战的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

因为这两个值都有两个下拉列表将从数据库加载,我需要在我的页面加载时最初有一个表的本地副本我将从中加载数据库,如果发生任何Dropdown选择事件,它应该在表的本地副本中搜索和过滤它不应该转到Database.and是否可能写入存储过程来操作本地副本

我不需要任何编码请说如何在复制表中检索和操作的概念名称,如果可能的话,可以加载并保留5或6表的本地副本。

解决方案

Quote:

你可以在.net中找到LINQ和实体框架(EDML文件)

,您可以使用linq查询加载表并在检索到的表上运行查询


您可以使用DataView。


首先声明一个Global DataTable。然后将所有数据库值存储到该数据表。

其次声明全局数据视图。



例如: -



 静态 DataTable dtTable; 
静态 DataView dvTable;





页面加载将所有数据库值保存到DataTable。



现在在该DataTable中执行您的搜索选项。

例如: -



 dvTable =  new  DataView(dtTable);  //  在数据视图中传递数据表对象。 
dvTable.RowFilter = 您的过滤器查询; // 使用RowFilter属性过滤您的值
// 然后将此数据视图绑定到您的控件
dropdown.DataSource = dvTable.ToTable();
dropdown.DataTextField = 您的文字字段;
dropdown.DataValueField = 您的值字段;
dropdown.DataBind();





希望你能得到它。



Happy Holi


Hi all,
Iam having Two drop downs for both the values will be loaded from the database, I need to have an local copy of the tables initially when my page is loading I will load from database, and after if any Dropdown selected event occurs it should search and filter within the local copy of table it should not go to the Database.and is it possible write Stored Procedure to manipulate within the local copy
I doesnt require any coding pls say whats the concept name of retrieving and manipulating within the copied table, if this is possible is it possible to load and keep an local copy of 5 or 6 Table.

解决方案

Quote:

You can go for LINQ and entity framework(EDML Files) in .net
where you can load the tables and run queries on the retrieved table using linq queries


You can use DataView for that.

First declare a Global DataTable. then store your all database value to that datatable.
Second declare a Global DataView.

Eg:-

static DataTable dtTable;
static DataView dvTable;



On Page Load save your all database value to DataTable.

Now perform your search option in that DataTable.
Eg:-

dvTable = new DataView(dtTable); //pass your datatable object in dataview.
dvTable.RowFilter = "your filter query"; //use RowFilter property to filter your value
//then bind this dataview to your control
dropdown.DataSource = dvTable.ToTable();
dropdown.DataTextField = "your text field";
dropdown.DataValueField = "your value field";
dropdown.DataBind();



Hope you got it.

Happy Holi.


这篇关于如何在页面加载时加载所有数据并创建一个temproary表,这是一个挑战的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆