2011-02-14 88 views
0

我的应用程序是在经典的ASP。目前SAVE功能需要大约30秒才能完成,过程如下:如何改进经典ASP中数据库的数据检索?

  1. 从UI读取数据。
  2. 发送到数据库。
  3. 从数据库中再次检索保存的数据以填充UI。 我需要一些其他方式来提高性能少于10秒。 例如:
  4. 使用XML和Web服务,但我不想将xml文件暂时保存在系统中。
  5. 使用JQuery和Ajax。 请建议我哪一个是可行的,并且会花费较少的代码也少维护。 如果任何人有,请给我任何代码或参考。因为我没有任何有关XML或JQuery或Ajax的经验。

感谢,

+0

嗯,你需要在SQL事件探查器跟踪,看看如果你的SQL在30秒内占用了25个:P – 2012-06-22 03:36:49

回答

0

如果您想更详细的回答,请描述你现在该怎么做你的过程。

有几个原因,为什么你的过程中花费太长的时间,例如:您的数据库和我们的应用服务器之间

  1. 连接。
  2. 如何编写用于检索或更新数据库的代码。
  3. 您使用哪种提供程序进行数据库连接。
  4. 是否有很多东西需要更新,什么样的数据。

等等。

的jQuery AJAX样本(这是Ajax调用用jQuery功能):

<script type="text/javascript"> 
    //this is for handling the button click event 
    $(function() { 
     $("#btnTest").click(function() { 
      //this is to call the function if click was initiated 
      AjaxTest(); 
     }); 
    }; 

    function AjaxTest() { 
     //this is variable to collect data 
     var _ajaxData= { firstName: "John", lastName: "Smith", email: "[email protected]" }; 

     //this is the main ajax function, it basically send the collected data 
     //to AjaxProcessPage.aspx and response back 
     $.post("AjaxProcessPage.aspx", _ajaxData, function (data) { 
      if (data.status == "ok") { 
       alert("Data is ok"); 
      }; 
     }); 
    } 
</script> 

<body> 
<input type="button" name="btnTest" id="btnTest" /> 
</body> 

说明是在注释,这基本上是在客户端侧。当数据发送到AjaxProcessPage.aspx时,您可以在该页面上插入流程。

有关jQuery的Ajax的更多信息: http://api.jquery.com/category/ajax/

欲了解更多信息jQuery的约$。员额()函数,我用: http://api.jquery.com/jQuery.post/