hi all forum, I am using jquery functions to retrieve data from database in my home page using like following
getNews();
getEvents();
getVideos(); etc...
when I did so I got an error in fire bug saying that a data reader try to open while the other is still openned and not closed. though each call deal with a different table but I COUldn't do the calls parralized so I begat to call one function and call the
next one in the success event of the first function and so on .
Thus I load my page sequentally not paraleized which make the page loads slowly. and if for any reason the first function faced an error all the subsequent functions will stop too. I want a solution that enables me to retrieve data from all tables in a parlized
way not sequentally one
Except for success handler, you'll also use error, timeout handler to handle the exceptions, if AJAX calls are not made successfully,
http://api.jquery.com/jQuery.ajax/
If each getSomething methods do not rely on each other, you can send multiple AJAX calls at the same time, not necessarilly in parellel
If each getSomething methods do not rely on each other, you can send multiple AJAX calls at the same time
each function grab data from different database table and don't depend on each other but they all asks for userId which gets its value from users table I think that's why they must wait for each other . Is there any way to work around this
when I did so I got an error in fire bug saying that a data reader try to open while the other is still openned and not closed.
This error is quite obvious.I got it.But i don't much understand about LinqToSql.
There are few way to solve it.
Explain what happen in ur code,or just show it. getNews();
--Here you open connection
--fetch record
--don't close it getEvents();
--second method start
--here again u open another connection
--fetch record
and so on
Explain what happen in ur code,or just show it. getNews();
--Here you open connection
--fetch record
--don't close it getEvents();
--second method start
--here again u open another connection
--fetch record
In my c# code I am using linq to sql and it is responsible for openning and closing connections with database in my webservice file I just call the Linq to sql functions in a static waybut I get this error
genius perso...
Member
129 Points
201 Posts
Parlel jquery ajax call
Jun 25, 2012 02:48 PM|LINK
hi all forum, I am using jquery functions to retrieve data from database in my home page using like following
getNews();
getEvents();
getVideos(); etc...
when I did so I got an error in fire bug saying that a data reader try to open while the other is still openned and not closed. though each call deal with a different table but I COUldn't do the calls parralized so I begat to call one function and call the next one in the success event of the first function and so on .
Thus I load my page sequentally not paraleized which make the page loads slowly. and if for any reason the first function faced an error all the subsequent functions will stop too. I want a solution that enables me to retrieve data from all tables in a parlized way not sequentally one
looking for your help
BU XI - MSFT
All-Star
22367 Points
2704 Posts
Microsoft
Re: Parlel jquery ajax call
Jun 27, 2012 03:48 AM|LINK
Hello
Except for success handler, you'll also use error, timeout handler to handle the exceptions, if AJAX calls are not made successfully, http://api.jquery.com/jQuery.ajax/
If each getSomething methods do not rely on each other, you can send multiple AJAX calls at the same time, not necessarilly in parellel
If you have any feedback about my replies, please contact msdnmg@microsoft.com.
Microsoft One Code Framework
KumarHarsh
All-Star
15155 Points
3658 Posts
Re: Parlel jquery ajax call
Jun 27, 2012 04:40 AM|LINK
why are you using datareader.
I think you should use dataset.
Kumar Harsh
genius perso...
Member
129 Points
201 Posts
Re: Parlel jquery ajax call
Jun 27, 2012 01:57 PM|LINK
I am using LinqToSql would you tell me how to do with it
genius perso...
Member
129 Points
201 Posts
Re: Parlel jquery ajax call
Jun 27, 2012 02:07 PM|LINK
each function grab data from different database table and don't depend on each other but they all asks for userId which gets its value from users table I think that's why they must wait for each other . Is there any way to work around this
KumarHarsh
All-Star
15155 Points
3658 Posts
Re: Parlel jquery ajax call
Jun 28, 2012 04:03 AM|LINK
This error is quite obvious.I got it.But i don't much understand about LinqToSql.
There are few way to solve it.
Explain what happen in ur code,or just show it.
getNews();
--Here you open connection
--fetch record
--don't close it
getEvents();
--second method start
--here again u open another connection
--fetch record
and so on
is this so ?
Kumar Harsh
sekarcse
Member
367 Points
87 Posts
Re: Parlel jquery ajax call
Jun 28, 2012 07:18 AM|LINK
Hello,
Here Issue is Two readers on the same connection
Sekar Perumal
Mark as Answer if you feel so. Because it will help others.
genius perso...
Member
129 Points
201 Posts
Re: Parlel jquery ajax call
Jun 28, 2012 11:16 AM|LINK
In my c# code I am using linq to sql and it is responsible for openning and closing connections with database in my webservice file I just call the Linq to sql functions in a static waybut I get this error
bruce (sqlwo...
All-Star
37594 Points
5573 Posts
Re: Parlel jquery ajax call
Jun 28, 2012 01:30 PM|LINK
you have to tell linq to release the connection. you should be calliing .Dispose() on the dbcontext or use the using statement.
using(var db = new MyDbContext())
{
note: as linq's dbcontext (nor the entity frameworks) is not thread safe, it should not be used for more than 1 request.
genius perso...
Member
129 Points
201 Posts
Re: Parlel jquery ajax call
Jun 30, 2012 02:25 PM|LINK
I began to split all the functions some to run in server sde codebehind on page load event and te rest will be put in the js file