Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i Use ajax to Call Codebehind Method Witch select Data From sql server DataBase But the response is too slow
Code :
C# :
C#
 [WebMethod]
public static string GetData(int ID)
{
 cmd.CommandText = "Select Name From table1 Where ID =" + ID;
    return   cmd.ExecuteScalar().ToString();
}

ajax :
JavaScript
<script type="text/javascript" language="javascript">
      
       function  GetDatainajax(node)
       {
         PageMethods.GetData(1,showdata);
       
       }
       function showdata(res)
       {       
           var elem = document.getElementById("text");
          
           elem.innerText = res;
       }
  <script>


i Need Help to get response more Fast
Posted
Updated 17-May-12 7:02am
v4

1 solution

There are any number of reasons why this might be slow but the first thing I'd do is to turn that sql string into a stored procedure and make sure that it is indexed appropriately.
 
Share this answer
 
Comments
bebo_s_80 18-May-12 4:19am    
Thanks for for your time, but I mean are there other way to send values from the server to the client faster than my code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900