Solved

Asynchronous ADO and DCOM

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

708 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

14 Experts available now in Live!

Get 1:1 Help Now