Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Backup and Restore SQL database with vb.net

Author  Topic 

ninel
Posting Yak Master

141 Posts

Posted - 2006-08-04 : 16:33:57
I have the following code:


Dim oSQLServer As New SQLDMO.SQLServer
Dim oBackup As New SQLDMO.Backup
Dim oRestore As New SQLDMO.Restore
Dim BACKUPFILE As String
Dim DATABASE As String

BACKUPFILE = "C:\VoicenetSQL\project\tampa\Politic\" & ProjectFolder & "\VoiceNet_TemplateBackup.bkp"

DATABASE = "VoiceNet_at0000"

With oBackup
.Files = BACKUPFILE
.Database = DATABASE
.BackupSetName = "VoiceNet"
.BackupSetDescription = "Backup from VB.NET application"
.oSQLServer.Connect("NINEL-D246655F1", "timecontroluser", "timecontroluser")
.SQLBackup(oSQLServer)
End With

oSQLServer.DisConnect()


This is not working. I am getting the following error:
"Public member 'oSQLServer' on type 'BackupClass' not found."

Does anyone know how to accomplish this?

Thanks,
Ninel

dfiala
Posting Yak Master

116 Posts

Posted - 2006-08-04 : 16:43:41
This
oSQLServer.Connect("NINEL-D246655F1", "timecontroluser", "timecontroluser")
is probably
SQLServer.Connect("NINEL-D246655F1", "timecontroluser", "timecontroluser")

Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP
Go to Top of Page

ninel
Posting Yak Master

141 Posts

Posted - 2006-08-07 : 10:26:42
I changed my code to reflect your post:

With oBackup
.Files = BACKUPFILE
.Database = DATABASE
.BackupSetName = "VoiceNet"
.BackupSetDescription = "Backup from VB.NET application"
.SQLServer.Connect("NINEL-D246655F1", "timecontroluser", "timecontroluser")
.SQLBackup(oSQLServer)
End With


I'm still getting the error : "Public member 'SQLServer' on type 'BackupClass' not found"

Any ideas what I'm doing wrong?

Thanks,
Ninel
Go to Top of Page

ninel
Posting Yak Master

141 Posts

Posted - 2006-08-07 : 10:33:05
Thank you for your help, but I figured out the issue.

I needed to move the following code out of the With statement.

oSQLServer.Connect("NINEL-D246655F1", "timecontroluser", "timecontroluser")
Go to Top of Page
   

- Advertisement -