'Send and receive multiple data without form being blocked by query

I am trying to make a program that process data that comes but send it to a container first before executing the query so the program still could receive data if the previous data has not been sent successfully.

basically

if NewData.Exists() :
ProcessNewDataToContainer()

and then

while Container.isNotEmpty() :
BuildQuery()
ExecuteQuery()

I was also looking for a way to do the query everytime it was called so it would be one straight process like

if NewData.Exists() :
    ProcessNewDataToContainer()
    BuildQuery()
    ExecuteQuery()

but I haven't find the right way to do it since everytime the query is executed, the program is blocked from doing the query while new data is still being sent to the program. so the program doesn't receive all data because the query is blocking it from processing new data

is there any way that I could do to make sure the program would receive all data and process it to database without the program being blocked by the query process?



Solution 1:[1]

Why not make sure the data is sent by:

Using End Using

that way you control when the connection for the query is disposed/closed

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Byte