473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

sql query in real time...ajax?

Hi all,

I'm looking for a way to show my users the progress of their sql
queries. I've implemented Microsoft Ajax in order to show a progress
bar, but I would love to be able to show:

number of rows loaded vs total rows

I tried a few searches for this, but haven't come up with the right
key words I guess. Right now I have zilch. So, it's easy enough to get
a count of the total rows before starting. I guess I need to query the
datasource every .5 to 1 second and display how many rows it has
retrieved already. This way the user has some idea how long the whole
thing is going to take.

Any ideas?

Thanks in advance.

Apr 19 '07 #1
6 3262
Sound like to much effort for something small.
So far all I saw is approximations.
Like we know that on average we get 100 rows per second so if you have 1000
records will be uploaded in 10 seconds.

If user gets lucky and it ends in 9 seconds then you finish your bar early
and user happy.
If not lucky then you simply push that indicator a little back.

You should be familiar with this approach if you ever tried to Copy/Delete a
lot of files in Windows.

George.

<ma********@gmail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
Hi all,

I'm looking for a way to show my users the progress of their sql
queries. I've implemented Microsoft Ajax in order to show a progress
bar, but I would love to be able to show:

number of rows loaded vs total rows

I tried a few searches for this, but haven't come up with the right
key words I guess. Right now I have zilch. So, it's easy enough to get
a count of the total rows before starting. I guess I need to query the
datasource every .5 to 1 second and display how many rows it has
retrieved already. This way the user has some idea how long the whole
thing is going to take.

Any ideas?

Thanks in advance.

Apr 19 '07 #2
On Apr 19, 1:15 pm, "George Ter-Saakov" <gt-...@cardone.comwrote:
Sound like to much effort for something small.
So far all I saw is approximations.
Like we know that on average we get 100 rows per second so if you have 1000
records will be uploaded in 10 seconds.

If user gets lucky and it ends in 9 seconds then you finish your bar early
and user happy.
If not lucky then you simply push that indicator a little back.

You should be familiar with this approach if you ever tried to Copy/Delete a
lot of files in Windows.

George.

<mattdad...@gmail.comwrote in message

news:11**********************@e65g2000hsc.googlegr oups.com...
Hi all,
I'm looking for a way to show my users the progress of their sql
queries. I've implemented Microsoft Ajax in order to show a progress
bar, but I would love to be able to show:
number of rows loaded vs total rows
I tried a few searches for this, but haven't come up with the right
key words I guess. Right now I have zilch. So, it's easy enough to get
a count of the total rows before starting. I guess I need to query the
datasource every .5 to 1 second and display how many rows it has
retrieved already. This way the user has some idea how long the whole
thing is going to take.
Any ideas?
Thanks in advance.
Don't talk to me about Windows OS progress bars....lol.

I don't know...this seems like basically the same concept of a
download progress bar, except instead of file sizes we are looking at
a database query. Also, it is a lot of effort...the first time. After
that, it's gravy. Thanks for your time.

Apr 19 '07 #3
On Apr 19, 6:24 pm, mattdad...@gmail.com wrote:
Hi all,

I'm looking for a way to show my users the progress of their sql
queries. I've implemented Microsoft Ajax in order to show a progress
bar, but I would love to be able to show:

number of rows loaded vs total rows
loaded where?

If you want to see a status of the SELECT...FROM query, you cannot get
it.
I think, you can have a kind of animated gif to imitate that process.
>
I tried a few searches for this, but haven't come up with the right
key words I guess. Right now I have zilch. So, it's easy enough to get
a count of the total rows before starting. I guess I need to query the
datasource every .5 to 1 second and display how many rows it has
retrieved already. This way the user has some idea how long the whole
thing is going to take.
Maybe you may need to think about paging? A more efficient way to
handle this is to use SQL Server (a server-side cursor, or can be
implemented using a SQL Server stored procedure)

Apr 19 '07 #4
Thanks for your response. There are some cases, like when my users are
exporting a report to excel that it would be cool to show them exactly
how much time and/or rows are left. So, if I bind a datasource to a
datatable, I cannot use client-side AJAX type code to read how many
rows have been added to the datatable?

I honestly don't know much about how this mechanism works, but I
thought the rows were added as they are received.

On Apr 19, 3:42 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Apr 19, 6:24 pm, mattdad...@gmail.com wrote:
Hi all,
I'm looking for a way to show my users the progress of their sql
queries. I've implemented Microsoft Ajax in order to show a progress
bar, but I would love to be able to show:
number of rows loaded vs total rows

loaded where?

If you want to see a status of the SELECT...FROM query, you cannot get
it.
I think, you can have a kind of animated gif to imitate that process.
I tried a few searches for this, but haven't come up with the right
key words I guess. Right now I have zilch. So, it's easy enough to get
a count of the total rows before starting. I guess I need to query the
datasource every .5 to 1 second and display how many rows it has
retrieved already. This way the user has some idea how long the whole
thing is going to take.

Maybe you may need to think about paging? A more efficient way to
handle this is to use SQL Server (a server-side cursor, or can be
implemented using a SQL Server stored procedure)

Apr 21 '07 #5
On Apr 22, 1:46 am, mattdad...@gmail.com wrote:
exporting a report to excel that it would be cool to show them exactly
how much time and/or rows are left. So, if I bind a datasource to a
In this case, I think, you offer a download the file (an export).
Make a page in between as follows. It will show a "status" of the
export.

Replace the "ExportToExcel.aspx" to a name of your export page.

----------------------------------------------------------------------------------------------------------
<%@ Page Language="vb" %>
<HTML>
<HEAD>
<script language="javascript">

var iLoopCounter = 1;
var iMaxLoop = 5;
var iIntervalId;

function BeginPageLoad() {
location.href = "ExportToExcel.aspx";
iIntervalId =
window.setInterval("iLoopCounter=UpdateProgress(iL oopCounter,
iMaxLoop)", 500);
}

function EndPageLoad() {
window.clearInterval(iIntervalId);
Progress.innerText = "Page Loaded -- Not Transferring";
}

function UpdateProgress(iCurrentLoopCounter, iMaximumLoops) {

iCurrentLoopCounter += 1;

if (iCurrentLoopCounter <= iMaximumLoops) {
Progress.innerText += ".";
return iCurrentLoopCounter;
}
else {
Progress.innerText = "";
return 1;
}
}
</script>
</HEAD>
<body onload="BeginPageLoad()" onunload="EndPageLoad()">
Loading&nbsp;- Please Wait</span<span id="Progress"></span>
</body>
</HTML>

Apr 22 '07 #6
On Apr 22, 3:41 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Apr 22, 1:46 am, mattdad...@gmail.com wrote:
exporting a report to excel that it would be cool to show them exactly
how much time and/or rows are left. So, if I bind a datasource to a

In this case, I think, you offer a download the file (an export).
Make a page in between as follows. It will show a "status" of the
export.

Replace the "ExportToExcel.aspx" to a name of your export page.

----------------------------------------------------------------------------------------------------------
<%@ Page Language="vb" %>
<HTML>
<HEAD>
<script language="javascript">

var iLoopCounter = 1;
var iMaxLoop = 5;
var iIntervalId;

function BeginPageLoad() {
location.href = "ExportToExcel.aspx";
iIntervalId =
window.setInterval("iLoopCounter=UpdateProgress(iL oopCounter,
iMaxLoop)", 500);

}

function EndPageLoad() {
window.clearInterval(iIntervalId);
Progress.innerText = "Page Loaded -- Not Transferring";

}

function UpdateProgress(iCurrentLoopCounter, iMaximumLoops) {

iCurrentLoopCounter += 1;

if (iCurrentLoopCounter <= iMaximumLoops) {
Progress.innerText += ".";
return iCurrentLoopCounter;
}
else {
Progress.innerText = "";
return 1;
}}

</script>
</HEAD>
<body onload="BeginPageLoad()" onunload="EndPageLoad()">
Loading&nbsp;- Please Wait</span<span id="Progress"></span>
</body>
</HTML>
Cool beans, I'll give it a shot. Thanks.

Apr 22 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Russ | last post by:
I'm interested in setting up a web page where live data can be displayed in real-time on the web page. For example: I would like to display a (nice looking) graph of some data value versus time...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
7
by: Ivan Marsh | last post by:
Hey Folks, I'm having a heck of a time wrapping mind around AJAX. Anyone know of a simple, straight-forward example for pulling a simple query from mysql with PHP using AJAX? As I...
9
by: Leslie Coover | last post by:
http://finance.yahoo.com/ offers a wide range of financial data. Would anyone have (or know where I can get) a sample of code that
3
by: SimonPlatten | last post by:
Hi, I'm a software engineer working in the offshore industry, I've been coding in various languages professionally since 1987. In my present employment I am working with control systems in the...
3
by: user | last post by:
Hi, let's say a page loads on a browser. Without refreshing the page, multiple textboxes within the page gets real time data @ a few seconds interval. what is the logic behind to achieve...
5
by: =?Utf-8?B?TWljaGFlbCBkZSBWZXJh?= | last post by:
To all, Not sure on how to approach this but what would be the best practice in showing status of a query that does an aggregation or count of some sort. if I were to have a sql statement that...
3
by: annecarterfredi | last post by:
I was getting snapshot since the database was responding very slow...here is the query that was in a snapshot: WITH TYPEINTS ( TYPEINT, COLTYPE ) AS ( VALUES ( SMALLINT(1 ), CHAR( 'INTEGER', ...
3
by: flashvarss | last post by:
Hi, I am making a web-based chat but to get the msg from the database i need to refresh the page and that will make load and extra bandwidth on the server so i want to make the query in real time...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.