<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>8 Jan 2015 09:56:00 Z</lastBuildDate><pubDate>8 Jan 2015 02:42:00 Z</pubDate><description>Hi&#13;
I have a class which uses a query which typically takes about 20 seconds to return the dataset. To show the user that something is happening I thought I would run this in a thread. This all appears to work correctly but it 'loses' the data! The data source for the query is declared global to the class &amp; if I just run the LoadData procedure outside of the thread it works fine.&#13;
&#13;
My code for the thread is as follows: ThreadExecute("thLoadData",threadGlobalContext,LoadData) //load recs in separate thread so we know something is happening IF NOT ThreadWait("thLoadData",6000) THEN IF ThreadState("thLoadData") =threadRunning THEN //if timeout exceeded the thread is still running ThreadStop("thLoadData") //so stop the thread {ls_Wait,indControl}..Visible = False //hide the processing icon Error("Unable to load data") //and report the error END END The code for Load Data is simply the SQL query code followed by HExecuteSQLQuery(datasource,hquerydefault,qrycode) HNBrec(Datasource) //force it to stay within proc until all records loaded Checking this value here I get 47953 records returned. If I put the same thing at the end of the procedure containing the ThreadExecute code I get an error that the data source doesn't exist.&#13;
&#13;
Any ideas what I'm missing?&#13;
&#13;
Thanks&#13;
&#13;
David</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/49785-wd17-thread-problem/read.awp</link><title>[WD17] Thread problem</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster><item><author>guest</author><category>pcsoft.us.windev</category><comments>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/49785-wd17-thread-problem-49791/read.awp</comments><pubDate>8 Jan 2015 09:56:00 Z</pubDate><description>Hi David&#13;
&#13;
the thread is simply (and always) running with an INDEPENDANT HF context... And this context will disappear when the…</description><guid isPermaLink="true">https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/49785-wd17-thread-problem-49791/read.awp</guid><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/49785-wd17-thread-problem-49791/read.awp</link><source url="https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/49785-wd17-thread-problem/read.awp">[WD17] Thread problem</source><title>Re: [WD17] Thread problem</title></item></channel></rss>
