473,473 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Wait for query to finish executing before running next query

1 New Member
Hello,

Is there a way to make my vb code to wait for a mysql query to finish executing before trying to run a new query?

For example: Is there a way I can run a CREATE TEMPORARY TABLE _mytable AS SELECT etc, etc, etc, wait until the temp table is created, then run SELECT * FROM _mytable?

I'm using VB 08 Pro and MySql 5.1.


Thanks,
Rick
Nov 19 '08 #1
5 7931
rpicilli
77 New Member
There is some ways.

I think the easy is to do the following

First create you TmpTable

Secong put your code to select data from the just create table into a Try Catch

Look for the error. If the error was something like Table not found or Table Locked or anything that you can check stay there waiting to your table became available.

I hope this help you

Rpicilli
Nov 19 '08 #2
Plater
7,872 Recognized Expert Expert
What is your code doing?
My code always blocks until the completion of query.
Nov 19 '08 #3
Telinstryata
11 New Member
Don't know for sure if this will work, but in T-SQL you can put a GO between statements to make sure that previous statements finish before starting the next statements. I don't know if you can use GO in a query like this (because I've never tried) but try something like the following...

"CREATE STATEMENT; GO; SELECT STATEMENT;"
Nov 19 '08 #4
Curtis Rutland
3,256 Recognized Expert Specialist
I don't think that the GO statements will work in the command objects.

It depends on how you write your queries. Some sample code of what you're doing would help. Like Plater says, mine hangs until my queries are finished, but if you're doing them in a different thread, then you have different issues.
Nov 19 '08 #5
balabaster
797 Recognized Expert Contributor
In my experience, when .NET triggers a command it waits for some response from the server and if it receives something it moves on, otherwise it carries on waiting.

Alas, any response triggers .NET to stop waiting...

An easy trick to get around this is to add Set NoCount On to the start of each procedure, manually keep track of the changes inside your procedure and then Set NoCount Off at the end before returning the manually calculated change count.

This will prevent SQL Server from providing false starts...

If you don't do this and you have a bunch of inserts at the start of your query, it will respond with a bunch "1 row updated" statements - the first of which will cause your .NET code to continue on its merry way thinking that the query has come to its conclusion.
Nov 19 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: deko | last post by:
I'm a little nervous about slamming my database with a dozen Update queries in a loop that all modify RecordSources of open forms. Will the use of DoEvents and/or a Sleep function ameliorate any...
2
by: Gershon | last post by:
I have an ASP.NET/C# web application running against a SQL Server database using ADO.NET. Whenever there is a long-running database query, the web application hangs until the database query is...
0
by: peter palus | last post by:
Hi, I have a problem, how to cancel a running oracle-query. The situation: The user can type in a form, which kind of information he wants to now e.g. articletext like 'abc%'. This information...
6
by: Zairay | last post by:
Hi All, I have a problem with running a query. Str = "SELECT Biographies.BID, Biographies.family_name AS , " & _ "Biographies.first_name AS , Biographies.sonof AS , " & _...
9
by: JJM0926 | last post by:
I'm trying to create a running totals query in access 97. I have followed the directions on how to do it from Microsofts website article id 138911. I took their code they had and replaced it with...
12
by: yoavyoavyoav | last post by:
Hi , I would like a progress bar to be displayed while running an sql query. the progress bar doesn't have to move according to the query pace - I just want it to move back and forth while the...
4
kcdoell
by: kcdoell | last post by:
Hello: What is the best way to stop a report from running if the query is empty? Currently, I have a form that has a command button on it. The user has to make selections from 3 combo boxes on...
6
by: boliches64 | last post by:
I am trying to delete duplicate records from a table. I have successfully created a query to find the duplicates. My problem is running the query in the following statement SQLDeleteDuplicates =...
7
by: David Goldstraw | last post by:
I have two databases and I want to automate a process to find duplicates. I originally linked the table from one into the other but I have now gone down the route of importing the table from one db...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.