473,320 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,320 developers and data experts.

Asynchronous Query

Rabbit
12,516 Expert Mod 8TB
This will start an asynchronous query so that a large query doesn't tie up Access.

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Private WithEvents AsyncConnection As ADODB.Connection
  3.  
  4. Private Sub Command1_Click()
  5.     Const ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Data\Access\database1.mdb;Persist Security Info=False"
  6.  
  7.     Set AsyncConnection = New ADODB.Connection
  8.  
  9.     AsyncConnection.ConnectionString = ConnectionString
  10.     AsyncConnection.Open
  11.  
  12.     Const sql As String = "SELECT * FROM table1"
  13.  
  14.     Call AsyncConnection.Execute(sql, , CommandTypeEnum.adCmdText Or ExecuteOptionEnum.adAsyncExecute)
  15. End Sub
  16.  
  17. Private Sub AsyncConnection_ExecuteComplete(ByVal RecordsAffected As Long, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pCommand As ADODB.Command, ByVal pRecordset As ADODB.Recordset, ByVal pConnection As ADODB.Connection)
  18.     If (adStatus = adStatusOK) Then
  19.         Me.List2.RowSource = pRecordset.Source
  20.     End If
  21.  
  22.     If (pConnection.State = ObjectStateEnum.adStateOpen) Then
  23.         pConnection.Close
  24.     End If
  25. End Sub
  26.  
Jan 5 '11 #1
0 10187

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

Similar topics

0
by: Zach Tong | last post by:
Hi all, I've got a minor problem that I think deals with synchronization. I've got asynchronous socket code working on my server. When it recieves a command, it will call the follow function to...
0
by: Passynkov, Vadim | last post by:
I am using Asynchronous Query Processing interface from libpq library. And I got some strange results on Solaris My test select query is 'SELECT * from pg_user;' and I use select system...
8
by: Trotsky | last post by:
Hi I have asked a similar question on the web services discussion group, but the question is a bit more related to ASP.Net. Basically I have a ASP.Net application that calls a web service...
3
by: usenetaccount | last post by:
In a newly created test app, to maximize client performance I tried to make two SOAP method calls in tandem (the soap methods execute some specified query), as each call includes a large amount of...
0
by: Mark Harrison | last post by:
Are there any asynchronous query examples online? I'm especially interested in event loop integration. Many TIA! Mark -- Mark Harrison Pixar Animation Studios
7
by: Siv | last post by:
Hi, I have a stored procedure that I want to execute and then wait in a loop showing a timer whilst it completes and then carry on once I get notification that it has completed. The main reason...
0
by: Bishoy George | last post by:
Hi, I have a asp.net 2.0 web application. I want to implement the asynchronous model through http handler in web.config ...
4
by: mbrierst | last post by:
Is it at all possible to do asynchronous SQL queries with Visual Studio 2003 / .NET version 1.1? I know this can be done with VS 2005 .NET 2.0, but that's not an option for me right now. Is there...
10
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi, Problem: How can I databind (or put) a SqlServer query's row return of 115,000 items into a ComboBox quickly? Not much longer than a matter of seconds, that is... Scenario: I am...
0
by: Kozy | last post by:
Hello everyone, i have a big problem with imports. I have only see this problem on 9.5, i have never goten it on 9.1. 99% of time db2 works great ( version 9.5 fixpack 5 ) on windows 2008 (...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.