运行查询只有一次 [英] Running queries once only

查看:241
本文介绍了运行查询只有一次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含2个按钮的应用程序。

I have an application which contains 2 buttons.

按钮1此查询给出结果:

Button 1 gives the result by this query:

select * from tbl1;

按钮2这个疑问给出结果:

Button 2 gives the result by this queries:

select * from tbl1;
select * from tbl2;

所以,发生了什么事是,我要运行 SELECT *从TBL 1 两次,一次扣1,并再次为按钮2。

So what's happening is that I have to run select * from tbl1 twice, Once for button 1 and once again for button 2.

是否有可能一次运行这两个查询按钮1被点击时,但只显示结果从 TBL 1 ,然后显示来自结果tbl2的按钮2被点击?

Is it possible to run both queries once when button 1 is clicked, but only show the results from tbl1, and then show the results from tbl2 when button 2 is clicked?

推荐答案

是的,缓存结果。它存储到一个变量(一个的集合的像列表),然后用它来显示结果,而不是的重新评估的查询。

Yes, cache the result. Store it into a variable (a collection like List) then use it to display result instead of re-evaluating the query.

这篇关于运行查询只有一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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