[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Asynchronous ADO and DCOM

Posted on 1998-11-17
4
Medium Priority
?
377 Views
Last Modified: 2013-12-25
Firstly, I am trying to get 5 (or more) threads in one process to connect (and eventually execute) asynchronously to an SQL Server (7 Beta 3) under VB5. The first one connects, but the others all sit aroiund and take up CPU. If I only have one thread in the process, it connects just fine and does not eat up CPU. How can I get many asynchronous threads working in the same process?

Secondly, when this single thread connects, I perform the async execute, and I want to return the data to another process (via DCOM). When ExecuteComplete is called, I use a
callback to comminucate with the other process, but it waits until the whole recordset is available i.e. all 5000 records are returned to executing thread. How can I return to the client process the recordset before it is complete?
0
Comment
Question by:fredforsyth
4 Comments
 
LVL 3

Expert Comment

by:vmano
ID: 1497702
i don't know the answer to your question but i would like to see the code for getting the 5 or more threads in one process. can you please post your code?

thanks
vmano
0
 
LVL 1

Expert Comment

by:zivf
ID: 1497703
as for the first part: you don't have control over thread creation in VB. you can initiate new child processes and control them using ActiveX EXE, but they will work in another process.

as for the second part: the async execute is notifyable only when a query is a really long time execution maker, and only when the server can send back some data before it finishes the query execution. for example: GROUP BY queries need to run through the whole query before any records are returned, as well as sorted queries (no always).
the async is in the context of execution and not in the context of the network traffic (although it be better if such a feature would exist) and a 5000 records query certainly does not seem to consume to much of any of them (although it might if these are summaries in a gouped query, in which case the begining of the answer applies)
0
 
LVL 1

Accepted Solution

by:
wizard2072098 earned 200 total points
ID: 1497704
Contrary to popular demand, you CAN create multiple threads in VB5/VB6. You just can't DEBUG them very easily in the VB IDE. Everything you've ever wanted to know about multithreading in VB can be found in the MSDN in an article entitled "Ingenious Ways to Implement Multiple Threads in Visual Basic 5.0" by John Robbins. If you don't have the MSDN, get on the MSDN on microsoft.com and read it there.

He gives examples, too.
0
 

Author Comment

by:fredforsyth
ID: 1497705
Sorry, i didn't mention that I'm using ADO to talk to the database. Basically, is it possible to use ADO with events in separate threads in a process?
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question