If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Asynchronous MySQL query not returning recordset data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-19-11, 04:03
DimitarS DimitarS is offline
Registered User
 
Join Date: May 2011
Posts: 1
Question Asynchronous MySQL query not returning recordset data

Hi, I'm trying to execute a select query that takes about 5 seconds to execute, during that time a timer is running and it is not frozen however once the query is finished, the pRecordset variable returns nothing.

After the query is finished executing the code goes to the function named
Private Sub m_conn_ExecuteComplete (found last on the code)
but I can't seem to be getting a recordset with data even though the RecordsAffected
parameter does return the count of how many records were returned.

I need to find out how to return data after the query executes(this it doesn't) AND asynchronously (this it does), any idea how I can get pRecordset to return data?

Quote:
Private WithEvents m_conn As ADODB.Connection
Dim rs As Recordset
Option Explicit


Private Sub cmdRun_Click()
Dim b As Long
Dim strSql As String
Dim cn As Connection
Set cn = New ADODB.Connection

Set m_conn = New ADODB.Connection
Call m_conn.Open(Module1.ConnectString("servername", "dbname", "root", "pass"), , , adAsyncConnect)

Set rs = New ADODB.Recordset 'Creates record set

strSql = " select distinct stock_stockvalues.stockid from stock_stockvalues where stockid not in (select distinct trans_detail.stockid From Trans_Detail where trans_detail.datetime > '2007-05-19 00:00:00' and trans_detail.datetime < '2011-05-19 08:03:35')"

Call m_conn.Execute(strSql, , adAsyncExecute)

End Sub

Private Sub Timer_Timer()
StatusBar.Panels(1).Text = CStr(DateTime.Now)
End Sub

Private Sub m_conn_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)

//here is where the code goes after the query is finished, but, pRecordset returns nada!

End Sub
Thanks

Last edited by DimitarS; 05-19-11 at 04:10.
Reply With Quote
Reply

Tags
asynchronous commit, mysql, vb6

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On