Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / February 2008



Tip: Looking for answers? Try searching our database.

Asynchronous backup

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hurricane_number_one@yahoo.com - 20 Feb 2008 21:37 GMT
I'm trying to backup a database but I want the process to be run in
the background so it doesn't lock up my program. I am doing the
following inside a class, it backs up the database in the background
just fine but it never fires ExecuteComplete. Any idea why??

Option Explicit

Private WithEvents myConn As ADODB.Connection

Public Function backup() As Boolean

   Set myConn = New ADODB.Connection

   If myConn.State = 0 Then
       myConn.Open strConnect
       myConn.CommandTimeout = 1000
   End If

   myConn.execute "BACKUP DATABASE MyDB TO DISK = 'C:\Temp\Backup'
WITH INIT", , adAsyncExecute

End Function

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

   MsgBox "BACKUP COMPLETE"

End Sub
Ralph - 20 Feb 2008 23:16 GMT
> I'm trying to backup a database but I want the process to be run in
> the background so it doesn't lock up my program. I am doing the
[quoted text clipped - 27 lines]
>
> End Sub

Are you opening the connection asynchronously (adConnectAsync)?

-ralph
hurricane_number_one@yahoo.com - 21 Feb 2008 05:23 GMT
I tried to open the connection asynchronously, but it never kicks off
the ConnectComplete event.

> <hurricane_number_...@yahoo.com> wrote in message
>
[quoted text clipped - 35 lines]
>
> -ralph
hurricane_number_one@yahoo.com - 21 Feb 2008 05:32 GMT
Yes, I tried that and it didn't make a difference:

> <hurricane_number_...@yahoo.com> wrote in message
>
[quoted text clipped - 35 lines]
>
> -ralph
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.