Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use progressbar with SQL passthrough statements

Status
Not open for further replies.

budjo

Programmer
Mar 4, 2004
19
PH
im using mysql as my remote database source ..
i have form .. with an active x progress bar (olecontrol1) which i got from the built - in active x controls ...

im using sqlexec to pass the sql statement i made...

i need help on how to update my progress bar while my sql statement executes ... is there any way for this ? thanks ..
 
budjo

I don't know about the activex one, but why not use the VFP one? Take a look at faq184-2801.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike, I think, 'budjo' want to show status of executing sqlstatement on server .

For example if he executes stored procedure that has 10 select statements, each of them take longer time to execute, he want to show in progressbar, which of that statement are just executing.

'budjo', I am using MS SQL 2000, an in this server there is
SET CONTEXT_INFO command which I am using to store current state.

In VFP than I have 2 connection handles.
One to execute wanted statement - asynchronous,
By the second I am reading context_info from system sysprocesses table in loop and showing that values in progressbar

I know nothing about MySql, but try to find something like
CONTEXT_INFO in MSSQL.
You need to store somewhere the value you want in stored procedure, but it must not depends by transaction or connection handle.

Or, if you only wants to run sql statement at background, so you can do another commands in VFP, try to experiment with Asynchronous connection.

Zhavic


---------------------------------------------------------------
In the 1960s you needed the power of two Comodore64s to get a rocket to the moon. Now you need a machine which is a vast number of times more powerful just to run the most popular GUI.
 
thanks for the reply guys .. I tried using asysnchronous functions but it seems its not working in vfp8, i have already set sqlsetprop(hndl,asynchoronous,.t.) but after i execute my sql statement , my app just freezes there and waits for the mysql server to process my request and return the sqlResult table ... I read somewhere that this was a bug and has been fixed on service pack 1 but I have already installed service pack one ...


tnx for the idead of two connection handles ..after i figure out the asynchoronous problem ..i think ill try that ..

budjo
 
budjo,

Here is some code that you can use. I haven't used this with a progress bar, but the principle is the same.

lnConn = SQLCONNECT('MyConnection')
SQLSETPROP(lnConn,'Asynchronous')
DO WHILE .T.
lnReply = SQLEXEC(lnConn,'SELECT * ... etc. etc')
DO CASE
CASE lnReply = 0
* still running
* update the progress bar here
CASE lnReply < 0
* something went wrong; do an error message
EXIT
CASE lnReply > 0
* finished
EXIT
ENDCASE
ENDDO

I hope that'll get you started.

Mike



Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top