Solved

Asynchronous ADO and DCOM

Posted on 1998-11-17
4
335 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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

943 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now