我如何计算从服务器获取数据时发生的时间. [英] How can i calculate time occur in fetching data from Server.

查看:97
本文介绍了我如何计算从服务器获取数据时发生的时间.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,亲爱的朋友,我想在我的asp.net网页中显示从sql server提取数据时出现的秒数,请帮助我.例如在google中,当有人搜索任何术语时,google会显示一些内容并显示从服务器获取数据所花费的时间.

Hello Dear Friends I want to show seconds in my asp.net web page that is occurring in fetching data from sql server please help me. for example in google when someone searches any term google will display something and displays seconds took in fetching data from server.

推荐答案

在后面的代码中,您可以使用属于System.Diagnostics的一部分;

在抓取开始之前立即启动秒表,并在完成后停止秒表.然后,只需查看该操作所花费的时间即可.

请参阅此链接,以获取StopWatch上的文档 system.diagnostics.stopwatch [ ^ ]
In the code behind you could employ a Stopwatch which is part of System.Diagnostics;

Start the stopwatch immediately before the fetch begins, and stop it when complete. Then just look at the elapsed time for the operation.

See this link for the documentation on StopWatch system.diagnostics.stopwatch[^]


这篇关于我如何计算从服务器获取数据时发生的时间.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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